Lines Matching refs:cset
118 static char *BuildCharSet(CharSet *cset, char *format);
119 static int CharInSet(CharSet *cset, int ch);
120 static void ReleaseCharSet(CharSet *cset);
141 static char * BuildCharSet(CharSet *cset, char *format) in BuildCharSet() argument
147 memset(cset, 0, sizeof(CharSet)); in BuildCharSet()
151 cset->exclude = 1; in BuildCharSet()
170 cset->chars = (char *) safe_emalloc(sizeof(char), (end - format - 1), 0); in BuildCharSet()
172 cset->ranges = (struct Range *) safe_emalloc(sizeof(struct Range), nranges, 0); in BuildCharSet()
174 cset->ranges = NULL; in BuildCharSet()
180 cset->nchars = cset->nranges = 0; in BuildCharSet()
184 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
201 cset->chars[cset->nchars++] = start; in BuildCharSet()
202 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
210 cset->ranges[cset->nranges].start = start; in BuildCharSet()
211 cset->ranges[cset->nranges].end = *ch; in BuildCharSet()
213 cset->ranges[cset->nranges].start = *ch; in BuildCharSet()
214 cset->ranges[cset->nranges].end = start; in BuildCharSet()
216 cset->nranges++; in BuildCharSet()
219 cset->chars[cset->nchars++] = *ch; in BuildCharSet()
242 static int CharInSet(CharSet *cset, int c) in CharInSet() argument
247 for (i = 0; i < cset->nchars; i++) { in CharInSet()
248 if (cset->chars[i] == ch) { in CharInSet()
254 for (i = 0; i < cset->nranges; i++) { in CharInSet()
255 if ((cset->ranges[i].start <= ch) in CharInSet()
256 && (ch <= cset->ranges[i].end)) { in CharInSet()
262 return (cset->exclude ? !match : match); in CharInSet()
281 static void ReleaseCharSet(CharSet *cset) in ReleaseCharSet() argument
283 efree((char *)cset->chars); in ReleaseCharSet()
284 if (cset->ranges) { in ReleaseCharSet()
285 efree((char *)cset->ranges); in ReleaseCharSet()
874 CharSet cset; in php_sscanf_internal() local
881 format = BuildCharSet(&cset, format); in php_sscanf_internal()
884 if (!CharInSet(&cset, (int)sch)) { in php_sscanf_internal()
892 ReleaseCharSet(&cset); in php_sscanf_internal()