diff options
author | Joshua Haberman <joshua@reverberate.org> | 2011-02-03 16:02:35 -0800 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2011-02-03 16:02:35 -0800 |
commit | f07cd8ff1d2a5079a7ce3cc571b40c9e209175c9 (patch) | |
tree | a040c23f951328414d9e0160dc1583716292b989 /src/upb.c | |
parent | 63daaaca4f750d9c1e88b2b3ca258912d58d4120 (diff) | |
parent | 8465e5e65014ac080d62855f8abfd44acdf7beb2 (diff) |
Merge branch 'src-refactoring'
Diffstat (limited to 'src/upb.c')
-rw-r--r-- | src/upb.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/upb.c b/src/upb.c deleted file mode 100644 index 146a9a5..0000000 --- a/src/upb.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * upb - a minimalist implementation of protocol buffers. - * - * Copyright (c) 2009 Joshua Haberman. See LICENSE for details. - * - */ - -#include <stdarg.h> -#include <stddef.h> - -#include "upb.h" - -#define alignof(t) offsetof(struct { char c; t x; }, x) -#define TYPE_INFO(proto_type, wire_type, ctype) \ - [GOOGLE_PROTOBUF_FIELDDESCRIPTORPROTO_TYPE_ ## proto_type] = \ - {alignof(ctype), sizeof(ctype), wire_type, #ctype}, - -upb_type_info upb_types[] = { - TYPE_INFO(DOUBLE, UPB_WIRE_TYPE_64BIT, double) - TYPE_INFO(FLOAT, UPB_WIRE_TYPE_32BIT, float) - TYPE_INFO(INT64, UPB_WIRE_TYPE_VARINT, int64_t) - TYPE_INFO(UINT64, UPB_WIRE_TYPE_VARINT, uint64_t) - TYPE_INFO(INT32, UPB_WIRE_TYPE_VARINT, int32_t) - TYPE_INFO(FIXED64, UPB_WIRE_TYPE_64BIT, uint64_t) - TYPE_INFO(FIXED32, UPB_WIRE_TYPE_32BIT, uint32_t) - TYPE_INFO(BOOL, UPB_WIRE_TYPE_VARINT, bool) - TYPE_INFO(MESSAGE, UPB_WIRE_TYPE_DELIMITED, void*) - TYPE_INFO(GROUP, UPB_WIRE_TYPE_START_GROUP, void*) - TYPE_INFO(UINT32, UPB_WIRE_TYPE_VARINT, uint32_t) - TYPE_INFO(ENUM, UPB_WIRE_TYPE_VARINT, uint32_t) - TYPE_INFO(SFIXED32, UPB_WIRE_TYPE_32BIT, int32_t) - TYPE_INFO(SFIXED64, UPB_WIRE_TYPE_64BIT, int64_t) - TYPE_INFO(SINT32, UPB_WIRE_TYPE_VARINT, int32_t) - TYPE_INFO(SINT64, UPB_WIRE_TYPE_VARINT, int64_t) - TYPE_INFO(STRING, UPB_WIRE_TYPE_DELIMITED, upb_strptr) - TYPE_INFO(BYTES, UPB_WIRE_TYPE_DELIMITED, upb_strptr) -}; - -void upb_seterr(upb_status *status, enum upb_status_code code, - const char *msg, ...) -{ - if(upb_ok(status)) { // The first error is the most interesting. - status->code = code; - va_list args; - va_start(args, msg); - vsnprintf(status->msg, UPB_ERRORMSG_MAXLEN, msg, args); - va_end(args); - } -} |