From 08e7ad94f99b5944405a40af5c28b9aa95e9c0b0 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Fri, 19 Aug 2011 22:30:13 -0700 Subject: Renamed lang_ext -> bindings, README updates. --- upb/descriptor.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'upb') diff --git a/upb/descriptor.c b/upb/descriptor.c index fbaef29..49ea5ae 100644 --- a/upb/descriptor.c +++ b/upb/descriptor.c @@ -304,6 +304,7 @@ static bool upb_fielddef_parsedefault(char *str, upb_value *d, int type) { } else if (type == UPB_TYPE(MESSAGE) || type == UPB_TYPE(GROUP)) { // We don't expect to get a default value. free(str); + upb_value_setptr(d, NULL); if (str != NULL) success = false; } else if (type == UPB_TYPE(BOOL)) { if (!str || strcmp(str, "false") == 0) @@ -356,6 +357,7 @@ static bool upb_fielddef_parsedefault(char *str, upb_value *d, int type) { upb_value_setfloat(d, strtof(str, &end)); if (errno == ERANGE || *end) success = false; break; + default: abort(); } free(str); } @@ -377,6 +379,7 @@ static void upb_fielddef_endmsg(void *_r, upb_status *status) { char *dstr = r->default_string; r->default_string = NULL; upb_value val; + upb_value_setptr(&val, NULL); // Silence inaccurate compiler warnings. if (!upb_fielddef_parsedefault(dstr, &val, f->type)) { // We don't worry too much about giving a great error message since the // compiler should have ensured this was correct. -- cgit v1.2.3