diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2016-05-12 11:54:34 -0700 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2016-05-12 11:54:34 -0700 |
commit | fa338b70a602d9f5657528d0322535959a92d4b0 (patch) | |
tree | a7ec8b8d61a1ff3657aff99316ec51a8b81726ad /upb/bindings/lua/upb.c | |
parent | e16ed470be7d0d459e85e1d7b43893358a625d34 (diff) |
Added UPB_ASSERT() that helps avoid unused var warnings.
* Added UPB_ASSERT() that helps avoid unused var warnings.
* Addressed PR comments.
* Fixed assert in the JIT.
Diffstat (limited to 'upb/bindings/lua/upb.c')
-rw-r--r-- | upb/bindings/lua/upb.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/upb/bindings/lua/upb.c b/upb/bindings/lua/upb.c index 4768212..1483676 100644 --- a/upb/bindings/lua/upb.c +++ b/upb/bindings/lua/upb.c @@ -141,7 +141,7 @@ static void *newudata_with_userval(lua_State *L, size_t size, /* Set metatable. */ luaL_getmetatable(L, type); - assert(!lua_isnil(L, -1)); /* Should have been created by luaopen_upb. */ + UPB_ASSERT(!lua_isnil(L, -1)); /* Should have been created by luaopen_upb. */ lua_setmetatable(L, -2); lua_newtable(L); @@ -322,7 +322,7 @@ bool lupb_refcounted_pushwrapper(lua_State *L, const upb_refcounted *obj, /* Lookup our cache in the registry (we don't put our objects in the registry * directly because we need our cache to be a weak table). */ lua_getfield(L, LUA_REGISTRYINDEX, LUPB_OBJCACHE); - assert(!lua_isnil(L, -1)); /* Should have been created by luaopen_upb. */ + UPB_ASSERT(!lua_isnil(L, -1)); /* Should have been created by luaopen_upb. */ lua_pushlightuserdata(L, (void*)obj); lua_rawget(L, -2); /* Stack is now: objcache, cached value. */ @@ -382,7 +382,7 @@ void lupb_refcounted_pushnewrapper(lua_State *L, const upb_refcounted *obj, const char *type, const void *ref_donor) { bool created = lupb_refcounted_pushwrapper(L, obj, type, ref_donor, sizeof(void *)); - UPB_ASSERT_VAR(created, created == true); + UPB_ASSERT(created == true); } static int lupb_refcounted_gc(lua_State *L) { @@ -461,7 +461,7 @@ bool lupb_def_pushwrapper(lua_State *L, const upb_def *def, void lupb_def_pushnewrapper(lua_State *L, const upb_def *def, const void *ref_donor) { bool created = lupb_def_pushwrapper(L, def, ref_donor); - UPB_ASSERT_VAR(created, created == true); + UPB_ASSERT(created == true); } static int lupb_def_type(lua_State *L) { @@ -1310,7 +1310,7 @@ static int lupb_filedefiter_next(lua_State *L) { const upb_def *def; def = upb_filedef_def(f, i); - assert(def); + UPB_ASSERT(def); if (type == UPB_DEF_ANY || upb_def_type(def) == type) { lua_pushinteger(L, i + 1); @@ -1738,7 +1738,7 @@ static lupb_msgdef *lupb_msg_assignoffsets(lua_State *L, int narg) { upb_fielddef *f = upb_msg_iter_field(&i); if (upb_fielddef_type(f) == UPB_TYPE_MESSAGE) { bool created = lupb_def_pushwrapper(L, upb_fielddef_subdef(f), NULL); - UPB_ASSERT_VAR(created, !created); + UPB_ASSERT(!created); lupb_msg_assignoffsets(L, -1); lua_rawseti(L, -2, idx++); /* Append to uservalue. */ } |