more verbose context ops
[m6w6/ext-psi] / src / types / decl_struct.c
index cfe46c91e5b535b1807b88d8d5532696d5b7ce37..d2a211d5c467596e4c079a96903b5401d6f4b354 100644 (file)
@@ -31,7 +31,7 @@
 struct psi_decl_struct* psi_decl_struct_init(zend_string *name,
                struct psi_plist *args)
 {
-       struct psi_decl_struct *s = calloc(1, sizeof(*s));
+       struct psi_decl_struct *s = pecalloc(1, sizeof(*s), 1);
        s->name = zend_string_copy(name);
        s->args = args;
        return s;
@@ -47,22 +47,19 @@ void psi_decl_struct_free(struct psi_decl_struct **s_ptr)
                if (s->args) {
                        psi_plist_free(s->args);
                }
-               if (s->engine.type && s->engine.dtor) {
-                       s->engine.dtor(s->engine.type);
-               }
                zend_string_release(s->name);
                free(s);
        }
 }
 
-void psi_decl_struct_dump(int fd, struct psi_decl_struct *strct)
+void psi_decl_struct_dump(struct psi_dump *dump, struct psi_decl_struct *strct)
 {
-       dprintf(fd, "struct %s::(%zu, %zu)", strct->name->val, strct->align,
+       PSI_DUMP(dump, "struct %s::(%zu, %zu)", strct->name->val, strct->align,
                        strct->size);
        if (psi_plist_count(strct->args)) {
-               psi_decl_type_dump_args_with_layout(fd, strct->args, 0);
+               psi_decl_type_dump_args_with_layout(dump, strct->args, 0);
        } else {
-               dprintf(fd, ";");
+               PSI_DUMP(dump, ";");
        }
 }
 
@@ -177,7 +174,7 @@ bool psi_decl_struct_validate(struct psi_data *data, struct psi_decl_struct *s,
                        align = psi_decl_arg_align(darg, &pos, &len);
 
                        if (darg->layout) {
-                               if (darg->layout->pos != pos) {
+                               if (darg->layout->pos != pos && !darg->layout->bfw) {
                                        data->error(data, darg->token, PSI_WARNING,
                                                        "Computed offset %zu of %s.%s does not match"
                                                        " pre-defined offset %zu",