Lines Matching refs:pglob

51 	glob_s_t *pglob = (glob_s_t *)stream->abstract;  in _php_glob_stream_get_path()  local
53 if (pglob && pglob->path) { in _php_glob_stream_get_path()
55 *plen = pglob->path_len; in _php_glob_stream_get_path()
57 return pglob->path; in _php_glob_stream_get_path()
69 glob_s_t *pglob = (glob_s_t *)stream->abstract; in _php_glob_stream_get_pattern() local
71 if (pglob && pglob->pattern) { in _php_glob_stream_get_pattern()
73 *plen = pglob->pattern_len; in _php_glob_stream_get_pattern()
75 return pglob->pattern; in _php_glob_stream_get_pattern()
85 static inline int php_glob_stream_get_result_count(glob_s_t *pglob) in php_glob_stream_get_result_count() argument
87 return pglob->open_basedir_used ? (int) pglob->open_basedir_indexmap_size : pglob->glob.gl_pathc; in php_glob_stream_get_result_count()
92 glob_s_t *pglob = (glob_s_t *)stream->abstract; in _php_glob_stream_get_count() local
94 if (pglob) { in _php_glob_stream_get_count()
96 *pflags = pglob->flags; in _php_glob_stream_get_count()
98 return php_glob_stream_get_result_count(pglob); in _php_glob_stream_get_count()
108 static void php_glob_stream_path_split(glob_s_t *pglob, const char *path, int get_path, const char … in php_glob_stream_path_split() argument
124 if (pglob->path) { in php_glob_stream_path_split()
125 efree(pglob->path); in php_glob_stream_path_split()
130 pglob->path_len = path - gpath; in php_glob_stream_path_split()
131 pglob->path = estrndup(gpath, pglob->path_len); in php_glob_stream_path_split()
138 glob_s_t *pglob = (glob_s_t *)stream->abstract; in php_glob_stream_read() local
145 if (count == sizeof(php_stream_dirent) && pglob) { in php_glob_stream_read()
146 glob_result_count = php_glob_stream_get_result_count(pglob); in php_glob_stream_read()
147 if (pglob->index < (size_t) glob_result_count) { in php_glob_stream_read()
148 index = pglob->open_basedir_used && pglob->open_basedir_indexmap ? in php_glob_stream_read()
149 pglob->open_basedir_indexmap[pglob->index] : pglob->index; in php_glob_stream_read()
150 … php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[index], pglob->flags & GLOB_APPEND, &path); in php_glob_stream_read()
151 ++pglob->index; in php_glob_stream_read()
156 pglob->index = glob_result_count; in php_glob_stream_read()
157 if (pglob->path) { in php_glob_stream_read()
158 efree(pglob->path); in php_glob_stream_read()
159 pglob->path = NULL; in php_glob_stream_read()
169 glob_s_t *pglob = (glob_s_t *)stream->abstract; in php_glob_stream_close() local
171 if (pglob) { in php_glob_stream_close()
172 pglob->index = 0; in php_glob_stream_close()
173 globfree(&pglob->glob); in php_glob_stream_close()
174 if (pglob->path) { in php_glob_stream_close()
175 efree(pglob->path); in php_glob_stream_close()
177 if (pglob->pattern) { in php_glob_stream_close()
178 efree(pglob->pattern); in php_glob_stream_close()
180 if (pglob->open_basedir_indexmap) { in php_glob_stream_close()
181 efree(pglob->open_basedir_indexmap); in php_glob_stream_close()
191 glob_s_t *pglob = (glob_s_t *)stream->abstract; in php_glob_stream_rewind() local
193 if (pglob) { in php_glob_stream_rewind()
194 pglob->index = 0; in php_glob_stream_rewind()
195 if (pglob->path) { in php_glob_stream_rewind()
196 efree(pglob->path); in php_glob_stream_rewind()
197 pglob->path = NULL; in php_glob_stream_rewind()
218 glob_s_t *pglob; in php_glob_stream_opener() local
229 pglob = ecalloc(1, sizeof(*pglob)); in php_glob_stream_opener()
231 if (0 != (ret = glob(path, pglob->flags & GLOB_FLAGMASK, NULL, &pglob->glob))) { in php_glob_stream_opener()
236 efree(pglob); in php_glob_stream_opener()
243 pglob->open_basedir_used = true; in php_glob_stream_opener()
244 for (i = 0; i < pglob->glob.gl_pathc; i++) { in php_glob_stream_opener()
245 if (!php_check_open_basedir_ex(pglob->glob.gl_pathv[i], 0)) { in php_glob_stream_opener()
246 if (!pglob->open_basedir_indexmap) { in php_glob_stream_opener()
247 pglob->open_basedir_indexmap = (size_t *) safe_emalloc( in php_glob_stream_opener()
248 pglob->glob.gl_pathc, sizeof(size_t), 0); in php_glob_stream_opener()
250 pglob->open_basedir_indexmap[pglob->open_basedir_indexmap_size++] = i; in php_glob_stream_opener()
265 pglob->pattern_len = strlen(pos); in php_glob_stream_opener()
266 pglob->pattern = estrndup(pos, pglob->pattern_len); in php_glob_stream_opener()
268 pglob->flags |= GLOB_APPEND; in php_glob_stream_opener()
270 if (pglob->glob.gl_pathc) { in php_glob_stream_opener()
271 php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[0], 1, &tmp); in php_glob_stream_opener()
273 php_glob_stream_path_split(pglob, path, 1, &tmp); in php_glob_stream_opener()
276 return php_stream_alloc(&php_glob_stream_ops, pglob, 0, mode); in php_glob_stream_opener()