Lines Matching refs:cset
114 static char *BuildCharSet(CharSet *cset, char *format);
115 static int CharInSet(CharSet *cset, int ch);
116 static void ReleaseCharSet(CharSet *cset);
137 static char * BuildCharSet(CharSet *cset, char *format) in BuildCharSet() argument
143 memset(cset, 0, sizeof(CharSet)); in BuildCharSet()
147 cset->exclude = 1; in BuildCharSet()
166 cset->chars = (char *) safe_emalloc(sizeof(char), (end - format - 1), 0); in BuildCharSet()
168 cset->ranges = (struct Range *) safe_emalloc(sizeof(struct Range), nranges, 0); in BuildCharSet()
170 cset->ranges = NULL; in BuildCharSet()
176 cset->nchars = cset->nranges = 0; in BuildCharSet()
180 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
197 cset->chars[cset->nchars++] = start; in BuildCharSet()
198 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
206 cset->ranges[cset->nranges].start = start; in BuildCharSet()
207 cset->ranges[cset->nranges].end = *ch; in BuildCharSet()
209 cset->ranges[cset->nranges].start = *ch; in BuildCharSet()
210 cset->ranges[cset->nranges].end = start; in BuildCharSet()
212 cset->nranges++; in BuildCharSet()
215 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
238 static int CharInSet(CharSet *cset, int c) in CharInSet() argument
243 for (i = 0; i < cset->nchars; i++) { in CharInSet()
244 if (cset->chars[i] == ch) { in CharInSet()
250 for (i = 0; i < cset->nranges; i++) { in CharInSet()
251 if ((cset->ranges[i].start <= ch) in CharInSet()
252 && (ch <= cset->ranges[i].end)) { in CharInSet()
258 return (cset->exclude ? !match : match); in CharInSet()
277 static void ReleaseCharSet(CharSet *cset) in ReleaseCharSet() argument
279 efree((char *)cset->chars); in ReleaseCharSet()
280 if (cset->ranges) { in ReleaseCharSet()
281 efree((char *)cset->ranges); in ReleaseCharSet()
860 CharSet cset; in php_sscanf_internal() local
867 format = BuildCharSet(&cset, format); in php_sscanf_internal()
870 if (!CharInSet(&cset, (int)sch)) { in php_sscanf_internal()
878 ReleaseCharSet(&cset); in php_sscanf_internal()