Lines Matching refs:gp
78 globfree(glob_t *gp)
82 if (gp->gl_pathv == 0)
85 for (i = gp->gl_offs; i < gp->gl_offs + gp->gl_pathc; ++i)
86 free(gp->gl_pathv[i]);
87 free((void *)gp->gl_pathv);
89 gp->gl_pathc = 0;
90 gp->gl_pathv = NULLCPP;
98 int (*errfn)(const char *, int), glob_t *gp)
106 gp->gl_offs = 0;
109 gp->gl_pathc = 0;
110 gp->gl_pathn = gp->gl_offs + INITIAL;
111 gp->gl_pathv = (char **)malloc(sizeof (char *) * gp->gl_pathn);
113 if (gp->gl_pathv == NULLCPP)
115 gp->gl_pathp = gp->gl_pathv + gp->gl_offs;
117 for (i = 0; i < gp->gl_offs; ++i)
118 gp->gl_pathv[i] = NULL;
124 ipathc = gp->gl_pathc;
125 rv = globit(0, pattern, gp, flags, errfn, &path);
136 i = gp->gl_pathc - ipathc;
138 qsort((char *)(gp->gl_pathp+ipathc), i, sizeof (char *),
143 (void) append(gp, pattern);
147 gp->gl_pathp[gp->gl_pathc] = NULL;
158 globit(size_t dend, const char *sp, glob_t *gp, int flags,
188 if (append(gp, *path) < 0) {
255 err = globit(end+n, sp, gp, flags, errfn, path);
282 append(glob_t *gp, const char *str)
288 gp->gl_pathp[gp->gl_pathc++] = strcpy(cp, str);
290 if ((gp->gl_pathc + gp->gl_offs) >= gp->gl_pathn) {
291 gp->gl_pathn *= 2;
292 gp->gl_pathv = (char **)realloc((void *)gp->gl_pathv,
293 gp->gl_pathn * sizeof (char *));
294 if (gp->gl_pathv == NULLCPP)
296 gp->gl_pathp = gp->gl_pathv + gp->gl_offs;