| 3032 | } php_class_field_table_t; |
| 3033 | |
| 3034 | static php_class_fields_t *fields_for(php_class_field_table_t *tab, const char *class_qn, |
| 3035 | CBMArena *arena) { |
| 3036 | for (int i = 0; i < tab->count; i++) { |
| 3037 | if (strcmp(tab->items[i].class_qn, class_qn) == 0) |
| 3038 | return &tab->items[i]; |
| 3039 | } |
| 3040 | if (tab->count >= tab->cap) { |
| 3041 | int new_cap = tab->cap ? tab->cap * 2 : 16; |
| 3042 | php_class_fields_t *next = |
| 3043 | (php_class_fields_t *)cbm_arena_alloc(arena, (size_t)new_cap * sizeof(*next)); |
| 3044 | if (!next) |
| 3045 | return NULL; |
| 3046 | for (int i = 0; i < tab->count; i++) |
| 3047 | next[i] = tab->items[i]; |
| 3048 | tab->items = next; |
| 3049 | tab->cap = new_cap; |
| 3050 | } |
| 3051 | php_class_fields_t *f = &tab->items[tab->count++]; |
| 3052 | memset(f, 0, sizeof(*f)); |
| 3053 | f->class_qn = cbm_arena_strdup(arena, class_qn); |
| 3054 | return f; |
| 3055 | } |
| 3056 | |
| 3057 | static void add_field(php_class_fields_t *f, CBMArena *arena, const char *name, |
| 3058 | const CBMType *type) { |
no test coverage detected