void check2(string str, string delim) { strsplit_out *out = strsplit(str, delim, false); strsplit_out *out2 = strsplit(str, delim, true); check_compressed(out2); check_splits_similar(out, out2); strsplit_free(out2); assert(out != NULL); assert(out->count > 0); assert(out->strings != NULL); char outs[strlen(str) + 2]; outs[strlen(str) + 1] = '\2'; strmov(outs, sizeof(outs) / sizeof(char), out->strings[0]); for (ulen i = 1; i < out->count; i++) { strapnd(outs, sizeof(outs) / sizeof(char), delim); strapnd(outs, sizeof(outs) / sizeof(char), out->strings[i]); } assert(outs[strlen(str)] == '\0'); assert(outs[strlen(str) + 1] == '\2'); assert(streq(str, outs)); strsplit_free(out); }
/* * struct group destructor */ void exfiles_group_destroy(struct group *grbuf) { if ( NULL != grbuf ) { if ( NULL != grbuf->gr_name ) { free(grbuf->gr_name); grbuf->gr_name = NULL; } if ( NULL != grbuf->gr_passwd ) { free(grbuf->gr_passwd); grbuf->gr_passwd = NULL; } grbuf->gr_gid = (gid_t) -1; if ( NULL != grbuf->gr_mem ) { strsplit_free(grbuf->gr_mem); grbuf->gr_mem = NULL; } } }