+
+ return pp_ret;
+}
+
+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++) {
+ if (pp_c->arg[i].reg != NULL) {
+ pp->arg[i].reg = strdup(pp_c->arg[i].reg);
+ my_assert_not(pp->arg[i].reg, NULL);
+ }
+ if (pp_c->arg[i].type.name != NULL) {
+ pp->arg[i].type.name = strdup(pp_c->arg[i].type.name);
+ my_assert_not(pp->arg[i].type.name, NULL);
+ }
+ if (pp_c->arg[i].fptr != NULL) {
+ pp->arg[i].fptr = malloc(sizeof(*pp->arg[i].fptr));
+ my_assert_not(pp->arg[i].fptr, NULL);
+ memcpy(pp->arg[i].fptr, pp_c->arg[i].fptr,
+ sizeof(*pp->arg[i].fptr));
+ }