#include "rpc_util.h"
list *proc_defined[MAX_PACKAGES], *special_defined, *typedef_defined,
- *uniondef_defined;
+ *uniondef_defined, *complex_defined;
char *SplitStart = NULL;
char *SplitEnd = NULL;
char *MasterPrefix = NULL;
declaration dec;
decl_list *decls;
decl_list **tailp;
+ int special = 0;
defp->def_kind = DEF_STRUCT;
tailp = &defp->def.st.decls;
do {
get_declaration(&dec, DEF_STRUCT);
+ /* If a structure contains an array, then we're going
+ * to need to be clever about freeing it */
+ if (dec.rel == REL_ARRAY) {
+ special = 1;
+ }
decls = ALLOC(decl_list);
decls->decl = dec;
*tailp = decls;
} while (tok.kind != TOK_RBRACE);
get_token(&tok);
*tailp = NULL;
+
+ if (special)
+ STOREVAL(&complex_defined, defp);
}
static void
for (listp = special_defined; listp != NULL; listp = listp->next) {
defp1 = (definition *) listp->val;
+
for (plist = defp->pc.plists; plist; plist = plist->next) {
if (plist->component_kind == DEF_PARAM
&& (plist->pl.param_kind == DEF_INPARAM
}
}
}
+ for (listp = complex_defined; listp != NULL; listp = listp->next) {
+ defp1 = (definition *) listp->val;
+ for (plist = defp->pc.plists; plist; plist = plist->next) {
+ if (plist->component_kind == DEF_PARAM) {
+ if (streq(defp1->def_name, structname(plist->pl.param_type))) {
+ plist->pl.param_flag |= FREETHIS_PARAM;
+ *somefrees = 1;
+ fprintf(fout, "\n\tmemset(&%s, 0, sizeof(%s));",
+ plist->pl.param_name, defp1->def_name);
+ }
+ }
+ }
+ }
+
f_print(fout, "\n");
}