summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/make_c_api.lua11
-rw-r--r--tools/upbc.lua4
-rw-r--r--upb/msg.c4
-rw-r--r--upb/msg.h2
4 files changed, 13 insertions, 8 deletions
diff --git a/tools/make_c_api.lua b/tools/make_c_api.lua
index 62fd370..9e6d734 100644
--- a/tools/make_c_api.lua
+++ b/tools/make_c_api.lua
@@ -30,11 +30,6 @@ function strip_proto(filename)
return string.gsub(filename, '%.proto$','')
end
---[[
- [upb.TYPE_ENUM] = 5,
- [upb.TYPE_MESSAGE] = 8,
---]]
-
local function join(...)
return table.concat({...}, ".")
end
@@ -154,6 +149,12 @@ local function field_layout_rank(field)
-- 4. string fields
-- 5. submessage fields
-- 6. repeated fields
+ --
+ -- This has the following nice properties:
+ --
+ -- 1. padding alignment is (nearly) minimized.
+ -- 2. fields that might have defaults (1-4) are segregated
+ -- from fields that are always zero-initialized (5-7).
local rank
if field:containing_oneof() then
rank = 100 -- These go last (actually we skip them).
diff --git a/tools/upbc.lua b/tools/upbc.lua
index 9d9531c..a538b1c 100644
--- a/tools/upbc.lua
+++ b/tools/upbc.lua
@@ -23,6 +23,10 @@ for _, argument in ipairs(arg) do
return 1
end
else
+ if src then
+ print("upbc can only handle one input file at a time.")
+ return 1
+ end
src = argument
end
end
diff --git a/upb/msg.c b/upb/msg.c
index eee0b3a..f0a4201 100644
--- a/upb/msg.c
+++ b/upb/msg.c
@@ -341,8 +341,8 @@ static upb_msglayout *upb_msglayout_new(const upb_msgdef *m) {
}
/* Size of the entire structure should be a multiple of its greatest
- * alignment. */
- l->data.size = align_up(l->data.size, 8 /* TODO: track for real? */);
+ * alignment. TODO: track overall alignment for real? */
+ l->data.size = align_up(l->data.size, 8);
if (upb_msglayout_initdefault(l, m)) {
return l;
diff --git a/upb/msg.h b/upb/msg.h
index 223d62f..71df7f1 100644
--- a/upb/msg.h
+++ b/upb/msg.h
@@ -410,7 +410,7 @@ typedef struct upb_msglayout_msginit_v1 {
const upb_msglayout_oneofinit_v1 *oneofs;
void *default_msg;
/* Must be aligned to sizeof(void*). Doesn't include internal members like
- * unknown * fields, extension dict, pointer to msglayout, etc. */
+ * unknown fields, extension dict, pointer to msglayout, etc. */
uint32_t size;
uint16_t field_count;
uint16_t oneof_count;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback