Lines Matching refs:cset
112 static char *BuildCharSet(CharSet *cset, char *format);
113 static int CharInSet(CharSet *cset, int ch);
114 static void ReleaseCharSet(CharSet *cset);
135 static char * BuildCharSet(CharSet *cset, char *format) in BuildCharSet() argument
141 memset(cset, 0, sizeof(CharSet)); in BuildCharSet()
145 cset->exclude = 1; in BuildCharSet()
164 cset->chars = (char *) safe_emalloc(sizeof(char), (end - format - 1), 0); in BuildCharSet()
166 cset->ranges = (struct Range *) safe_emalloc(sizeof(struct Range), nranges, 0); in BuildCharSet()
168 cset->ranges = NULL; in BuildCharSet()
174 cset->nchars = cset->nranges = 0; in BuildCharSet()
178 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
195 cset->chars[cset->nchars++] = start; in BuildCharSet()
196 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
204 cset->ranges[cset->nranges].start = start; in BuildCharSet()
205 cset->ranges[cset->nranges].end = *ch; in BuildCharSet()
207 cset->ranges[cset->nranges].start = *ch; in BuildCharSet()
208 cset->ranges[cset->nranges].end = start; in BuildCharSet()
210 cset->nranges++; in BuildCharSet()
213 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
236 static int CharInSet(CharSet *cset, int c) in CharInSet() argument
241 for (i = 0; i < cset->nchars; i++) { in CharInSet()
242 if (cset->chars[i] == ch) { in CharInSet()
248 for (i = 0; i < cset->nranges; i++) { in CharInSet()
249 if ((cset->ranges[i].start <= ch) in CharInSet()
250 && (ch <= cset->ranges[i].end)) { in CharInSet()
256 return (cset->exclude ? !match : match); in CharInSet()
275 static void ReleaseCharSet(CharSet *cset) in ReleaseCharSet() argument
277 efree((char *)cset->chars); in ReleaseCharSet()
278 if (cset->ranges) { in ReleaseCharSet()
279 efree((char *)cset->ranges); in ReleaseCharSet()
858 CharSet cset; in php_sscanf_internal() local
865 format = BuildCharSet(&cset, format); in php_sscanf_internal()
868 if (!CharInSet(&cset, (int)sch)) { in php_sscanf_internal()
876 ReleaseCharSet(&cset); in php_sscanf_internal()