diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-12-13 07:41:56 -0800 |
---|---|---|
committer | Joshua Haberman <jhaberman@gmail.com> | 2018-12-13 07:41:56 -0800 |
commit | cf0a89ed69561d73210056566272b27844a95782 (patch) | |
tree | 23cf201173db55cf6ebea5bc1d789598321c0818 /upb/bindings/lua/def.c | |
parent | b31df4c57de16f50c441e7860be931e10f9433f2 (diff) |
Updated to use the new array accessors.
Diffstat (limited to 'upb/bindings/lua/def.c')
-rw-r--r-- | upb/bindings/lua/def.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/upb/bindings/lua/def.c b/upb/bindings/lua/def.c index 1fde212..00b75c9 100644 --- a/upb/bindings/lua/def.c +++ b/upb/bindings/lua/def.c @@ -634,10 +634,9 @@ static int lupb_symtab_gc(lua_State *L) { * serialized string once we have a good story for vending compiled-in * messages. */ static int lupb_symtab_add(lua_State *L) { - size_t len; upb_arena *arena; - size_t i; - upb_array *file_arr; + size_t i, n, len; + const google_protobuf_FileDescriptorProto *const *files; google_protobuf_FileDescriptorSet *set; upb_symtab *s = lupb_symtab_check(L, 1); const char *str = luaL_checklstring(L, 2, &len); @@ -652,12 +651,9 @@ static int lupb_symtab_add(lua_State *L) { luaL_argerror(L, 2, "failed to parse descriptor"); } - file_arr = (upb_array*)google_protobuf_FileDescriptorSet_file(set); - for (i = 0; i < upb_array_size(file_arr); i++) { - upb_msgval entry = upb_array_get(file_arr, i); - google_protobuf_FileDescriptorProto *file = - (void *)upb_msgval_getmsg(entry); - CHK(upb_symtab_addfile(s, file, &status)); + files = google_protobuf_FileDescriptorSet_file(set, &n); + for (i = 0; i < n; i++) { + CHK(upb_symtab_addfile(s, files[i], &status)); } return 0; |