Skip to contentSkip to conversation

thunk: improve readability of allocation loop

PATCH Applied Aarushi Mehta 3 participants 3 messages Mar 8, 2019 – Mar 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thunk: improve readability of allocation loop

---
 thunk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
thunk.c +1 -1
index 17f3d320bb..7f31cffe09 100644
@@ -86,7 +86,7 @@ void thunk_register_struct(int id, const char *name, const argtype *types)
 #endif
     /* now we can alloc the data */
 
-    for(i = 0;i < 2; i++) {
+    for (i = 0; i < ARRAY_SIZE(se->field_offsets); i++) {
         offset = 0;
         max_align = 1;
         se->field_offsets[i] = g_new(int, nb_fields);
Signature · 1 line
2.17.1
#2 lore raw
In reply to Aarushi Mehta
Quoted 11 lines · Aarushi Mehta
---
 thunk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
thunk.c +0 -0
index 17f3d320bb..7f31cffe09 100644

thunk.c void thunk_register_struct(int id, const char *name, const argtype *types) · line 92

Quoted 8 lines
thunk.c +1 -1
@@ -86,7 +86,7 @@ void thunk_register_struct(int id, const char *name, const argtype *types)
 #endif
     /* now we can alloc the data */
 
-    for(i = 0;i < 2; i++) {
+    for (i = 0; i < ARRAY_SIZE(se->field_offsets); i++) {
         offset = 0;
         max_align = 1;
         se->field_offsets[i] = g_new(int, nb_fields);

Applied to my trivial-patches branch.

Thanks,
Laurent