+ if (s->fptr != NULL) {
+ d->fptr = malloc(sizeof(*d->fptr));
+ my_assert_not(d->fptr, NULL);
+ memcpy(d->fptr, s->fptr, sizeof(*d->fptr));
+ }
+}
+
+struct parsed_proto *proto_clone(const struct parsed_proto *pp_c)
+{
+ struct parsed_proto *pp;
+ int i;
+
+ pp = malloc(sizeof(*pp));
+ my_assert_not(pp, NULL);
+ memcpy(pp, pp_c, sizeof(*pp)); // lazy..
+
+ // do the actual deep copy..
+ for (i = 0; i < pp_c->argc; i++)
+ pp_copy_arg(&pp->arg[i], &pp_c->arg[i]);
+ if (pp_c->ret_type.name != NULL)
+ pp->ret_type.name = strdup(pp_c->ret_type.name);