From b3f6daf83d8adf0040a1bf9401342c811502f690 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Thu, 11 Dec 2014 18:58:04 -0800 Subject: Amalgamated distribution (upb.c/upb.h) tool. There are a number of tweaks to get this to work: - The #include dependence graph wasn't quite complete, and I had to add a few #includes to get the tool to work. - I had to change a number of symbol names to avoid conflicts between 'static' definitions in different .c files. This could be avoided if the tool were smart enough to rename static symbols to have unique prefixes instead, but (i) this requires semantic understanding of C, and (ii) the macro-defined static functions (e.g., handlers for primitive types in several places) would probably trip this up. Verified that the resulting upb.h/upb.c compiles and doesn't have any unresolved references. --- upb/pb/encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'upb/pb/encoder.c') diff --git a/upb/pb/encoder.c b/upb/pb/encoder.c index 4681c20..d2c22e9 100644 --- a/upb/pb/encoder.c +++ b/upb/pb/encoder.c @@ -109,7 +109,7 @@ static bool reserve(upb_pb_encoder *e, size_t bytes) { // Call when "bytes" bytes have been writte at e->ptr. The caller *must* have // previously called reserve() with at least this many bytes. -static void advance(upb_pb_encoder *e, size_t bytes) { +static void encoder_advance(upb_pb_encoder *e, size_t bytes) { assert((e->limit - e->ptr) >= bytes); e->ptr += bytes; } @@ -137,7 +137,7 @@ static bool encode_bytes(upb_pb_encoder *e, const void *data, size_t len) { } memcpy(e->ptr, data, len); - advance(e, len); + encoder_advance(e, len); return true; } @@ -274,7 +274,7 @@ static bool encode_varint(upb_pb_encoder *e, uint64_t val) { return false; } - advance(e, upb_vencode64(val, e->ptr)); + encoder_advance(e, upb_vencode64(val, e->ptr)); return true; } -- cgit v1.2.3