void dump_history_enroll(const ConsFun_t pfun, const char *label){ if(usr_hst_cnt >= MAX_USR_H_COUNT) ath_error("[dump_history_enroll]: MAX_USR_H_COUNT = %d exceeded\n", MAX_USR_H_COUNT); /* Copy the label string */ if((usr_label[usr_hst_cnt] = ath_strdup(label)) == NULL) ath_error("[dump_history_enroll]: Error on sim_strdup(\"%s\")\n",label); /* Store the function pointer */ phst_fun[usr_hst_cnt] = pfun; usr_hst_cnt++; return; }
static char *my_strdup(char *in) { char *out = ath_strdup(in); if(out == NULL) ath_error("Error allocating memory for a new string\n"); return out; }