Lines Matching refs:gt

90 	struct globtree *gt;
92 gt = xmalloc(sizeof(struct globtree));
93 gt->type = type;
94 gt->data = NULL;
95 gt->flags = 0;
96 gt->left = NULL;
97 gt->right = NULL;
98 return (gt);
104 struct globtree *gt;
106 gt = globtree_new(GLOBTREE_TRUE);
107 return (gt);
113 struct globtree *gt;
115 gt = globtree_new(GLOBTREE_FALSE);
116 return (gt);
122 struct globtree *gt;
124 gt = globtree_new(GLOBTREE_MATCH);
125 gt->data = xstrdup(pattern);
126 gt->flags = flags;
127 return (gt);
133 struct globtree *gt;
136 gt = globtree_new(GLOBTREE_REGEX);
137 gt->data = xmalloc(sizeof(regex_t));
138 error = regcomp(gt->data, pattern, REG_NOSUB);
140 return (gt);
146 struct globtree *gt;
151 gt = globtree_false();
152 return (gt);
162 gt = globtree_new(GLOBTREE_AND);
163 gt->left = left;
164 gt->right = right;
165 return (gt);
171 struct globtree *gt;
176 gt = globtree_true();
177 return (gt);
187 gt = globtree_new(GLOBTREE_OR);
188 gt->left = left;
189 gt->right = right;
190 return (gt);
196 struct globtree *gt;
200 gt = globtree_new(GLOBTREE_FALSE);
201 return (gt);
205 gt = globtree_new(GLOBTREE_TRUE);
206 return (gt);
208 gt = globtree_new(GLOBTREE_NOT);
209 gt->left = child;
210 return (gt);
215 globtree_eval(struct globtree *gt, const char *path)
219 switch (gt->type) {
225 assert(gt->data != NULL);
226 rv = fnmatch(gt->data, path, gt->flags);
232 assert(gt->data != NULL);
233 rv = regexec(gt->data, path, 0, NULL, 0);
312 globtree_test(struct globtree *gt, const char *path)
322 while (gt->left != NULL) {
323 stack_push(&stack, gt, STATE_DOINGLEFT);
324 gt = gt->left;
328 val = globtree_eval(gt, path);
335 stack_pop(&stack, &gt, &state);
336 switch (gt->type) {
346 stack_push(&stack, gt,
348 gt = gt->right;
358 stack_push(&stack, gt,
360 gt = gt->right;
380 globtree_free(struct globtree *gt)
383 if (gt->data != NULL) {
384 if (gt->type == GLOBTREE_REGEX)
385 regfree(gt->data);
386 free(gt->data);
388 if (gt->left != NULL)
389 globtree_free(gt->left);
390 if (gt->right != NULL)
391 globtree_free(gt->right);
392 free(gt);