int ignore1(char **list, struct ignoretab *tab, char *which) { char field[LINESIZE]; char **ap; struct ignore *igp; int h; if (*list == NULL) return(igshow(tab, which)); for (ap = list; *ap != 0; ap++) { istrlcpy(field, *ap, sizeof(field)); if (member(field, tab)) continue; h = hash(field); igp = (struct ignore *)calloc(1, sizeof(struct ignore)); if (igp == NULL) errx(1, "Out of memory"); igp->i_field = strdup(field); if (igp->i_field == NULL) errx(1, "Out of memory"); igp->i_link = tab->i_head[h]; tab->i_head[h] = igp; tab->i_count++; } return(0); }
int ignore1(char **list, struct ignoretab *tab, const char *which) { char field[LINESIZE]; char **ap; struct ignore *igp; int h; if (*list == NULL) return (igshow(tab, which)); for (ap = list; *ap != 0; ap++) { istrncpy(field, *ap, sizeof(field)); if (member(field, tab)) continue; h = hash(field); igp = calloc(1, sizeof(struct ignore)); igp->i_field = calloc((unsigned)strlen(field) + 1, sizeof(char)); strcpy(igp->i_field, field); igp->i_link = tab->i_head[h]; tab->i_head[h] = igp; tab->i_count++; } return (0); }