Changeset 1145 for pjproject/trunk/pjlib-util/src/pjlib-util/scanner.c
- Timestamp:
- Apr 4, 2007 10:15:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util/scanner.c
r974 r1145 340 340 341 341 PJ_DEF(void) pj_scan_get_quote( pj_scanner *scanner, 342 int begin_quote, int end_quote, 343 pj_str_t *out) 344 { 345 register char *s = scanner->curptr; 346 342 int begin_quote, int end_quote, 343 pj_str_t *out) 344 { 345 pj_scan_get_quotes(scanner, (char*)&begin_quote, (char*)&end_quote, 1, out); 346 } 347 348 PJ_DEF(void) pj_scan_get_quotes(pj_scanner *scanner, 349 const char *begin_quote, const char *end_quote, 350 int qsize, pj_str_t *out) 351 { 352 register char *s = scanner->curptr; 353 int qpair = -1; 354 int i; 355 356 pj_assert(qsize > 0); 357 347 358 /* Check and eat the begin_quote. */ 348 if (*s != begin_quote) { 359 for (i = 0; i < qsize; ++i) { 360 if (*s == begin_quote[i]) { 361 qpair = i; 362 break; 363 } 364 } 365 if (qpair == -1) { 349 366 pj_scan_syntax_err(scanner); 350 367 return; … … 356 373 do { 357 374 /* loop until end_quote is found. */ 358 while (*s && *s != '\n' && *s != end_quote ) {375 while (*s && *s != '\n' && *s != end_quote[qpair]) { 359 376 ++s; 360 377 } 361 378 362 379 /* check that no backslash character precedes the end_quote. */ 363 if (*s == end_quote ) {380 if (*s == end_quote[qpair]) { 364 381 if (*(s-1) == '\\') { 365 382 if (s-2 == scanner->begin) { … … 390 407 391 408 /* Check and eat the end quote. */ 392 if (*s != end_quote ) {409 if (*s != end_quote[qpair]) { 393 410 pj_scan_syntax_err(scanner); 394 411 return; … … 404 421 } 405 422 } 423 406 424 407 425 PJ_DEF(void) pj_scan_get_n( pj_scanner *scanner,
Note: See TracChangeset
for help on using the changeset viewer.