diff options
-rw-r--r-- | Makefile | 20 | ||||
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | bindings/cpp/upb/handlers.hpp (renamed from lang_ext/cpp/upb/handlers.hpp) | 0 | ||||
-rw-r--r-- | bindings/lua/test.lua (renamed from lang_ext/lua/test.lua) | 0 | ||||
-rw-r--r-- | bindings/lua/upb.c (renamed from lang_ext/lua/upb.c) | 0 | ||||
-rw-r--r-- | bindings/python/setup.py (renamed from lang_ext/python/setup.py) | 0 | ||||
-rw-r--r-- | bindings/python/test.py (renamed from lang_ext/python/test.py) | 0 | ||||
-rw-r--r-- | bindings/python/upb.c (renamed from lang_ext/python/upb.c) | 0 | ||||
-rw-r--r-- | bindings/python/upb/__init__.py (renamed from lang_ext/python/upb/__init__.py) | 0 | ||||
-rw-r--r-- | upb/descriptor.c | 3 |
10 files changed, 15 insertions, 16 deletions
@@ -126,8 +126,8 @@ clean_leave_profile: rm -rf $(TESTS) tests/t.* rm -rf upb/descriptor.pb rm -rf tools/upbc deps - rm -rf lang_ext/lua/upb.so - rm -rf lang_ext/python/build + rm -rf bindings/lua/upb.so + rm -rf bindings/python/build clean: clean_leave_profile rm -rf $(call rwildcard,,*.gcno) $(call rwildcard,,*.gcda) @@ -464,21 +464,21 @@ else LUA_LDFLAGS = endif -LUAEXT=lang_ext/lua/upb.so +LUAEXT=bindings/lua/upb.so lua: $(LUAEXT) -lang_ext/lua/upb.so: lang_ext/lua/upb.c $(LIBUPB_PIC) - $(E) CC lang_ext/lua/upb.c +bindings/lua/upb.so: bindings/lua/upb.c $(LIBUPB_PIC) + $(E) CC bindings/lua/upb.c $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) $(LUA_CPPFLAGS) -fpic -shared -o $@ $< upb/libupb_pic.a $(LUA_LDFLAGS) # Python extension ############################################################# PYTHON=python -PYTHONEXT=lang_ext/python/build/install/lib/python/upb/__init__.so +PYTHONEXT=bindings/python/build/install/lib/python/upb/__init__.so python: $(PYTHONEXT) -$(PYTHONEXT): $(LIBUPB_PIC) lang_ext/python/upb.c - $(E) PYTHON lang_ext/python/upb.c - $(Q) cd lang_ext/python && $(PYTHON) setup.py build --debug install --home=build/install +$(PYTHONEXT): $(LIBUPB_PIC) bindings/python/upb.c + $(E) PYTHON bindings/python/upb.c + $(Q) cd bindings/python && $(PYTHON) setup.py build --debug install --home=build/install pythontest: $(PYTHONEXT) - cd lang_ext/python && cp test.py build/install/lib/python && valgrind $(PYTHON) ./build/install/lib/python/test.py + cd bindings/python && cp test.py build/install/lib/python && valgrind $(PYTHON) ./build/install/lib/python/test.py @@ -1,9 +1,9 @@ -upb - a minimalist implementation of protocol buffers. +upb - a small, low-level protocol buffer library For API documentation, see the header files. -To build (the core library is ANSI C and has no dependencies): +To build (the core library is ANSI C99 and has no dependencies): $ make Other useful targets: @@ -33,10 +33,6 @@ the major things that are broken or not yet implemented yet: - serialization isn't written yet (only deserialization) -- the language extensions that exist so far (Python and Lua) are totally - incomplete/broken. They are not usable for anything yet. This will - be remedied very soon. - CONTACT ======= diff --git a/lang_ext/cpp/upb/handlers.hpp b/bindings/cpp/upb/handlers.hpp index b083f15..b083f15 100644 --- a/lang_ext/cpp/upb/handlers.hpp +++ b/bindings/cpp/upb/handlers.hpp diff --git a/lang_ext/lua/test.lua b/bindings/lua/test.lua index 42bce25..42bce25 100644 --- a/lang_ext/lua/test.lua +++ b/bindings/lua/test.lua diff --git a/lang_ext/lua/upb.c b/bindings/lua/upb.c index fe523e7..fe523e7 100644 --- a/lang_ext/lua/upb.c +++ b/bindings/lua/upb.c diff --git a/lang_ext/python/setup.py b/bindings/python/setup.py index 8abaff8..8abaff8 100644 --- a/lang_ext/python/setup.py +++ b/bindings/python/setup.py diff --git a/lang_ext/python/test.py b/bindings/python/test.py index 29a6c45..29a6c45 100644 --- a/lang_ext/python/test.py +++ b/bindings/python/test.py diff --git a/lang_ext/python/upb.c b/bindings/python/upb.c index ffb3d52..ffb3d52 100644 --- a/lang_ext/python/upb.c +++ b/bindings/python/upb.c diff --git a/lang_ext/python/upb/__init__.py b/bindings/python/upb/__init__.py index e69de29..e69de29 100644 --- a/lang_ext/python/upb/__init__.py +++ b/bindings/python/upb/__init__.py 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. |