/[pcre]/code/trunk/pcreposix.c
ViewVC logotype

Diff of /code/trunk/pcreposix.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 498 by ph10, Mon Oct 5 10:59:35 2009 UTC revision 499 by ph10, Wed Mar 3 20:09:39 2010 UTC
# Line 344  rc = pcre_exec((const pcre *)preg->re_pc Line 344  rc = pcre_exec((const pcre *)preg->re_pc
344    
345  if (rc == 0) rc = nmatch;    /* All captured slots were filled in */  if (rc == 0) rc = nmatch;    /* All captured slots were filled in */
346    
347    /* Successful match */
348    
349  if (rc >= 0)  if (rc >= 0)
350    {    {
351    size_t i;    size_t i;
# Line 360  if (rc >= 0) Line 362  if (rc >= 0)
362    return 0;    return 0;
363    }    }
364    
365  else  /* Unsuccessful match */
366    
367    if (allocated_ovector) free(ovector);
368    switch(rc)
369    {    {
370    if (allocated_ovector) free(ovector);  /* ========================================================================== */
371    switch(rc)    /* These cases are never obeyed. This is a fudge that causes a compile-time
372      {    error if the vector eint, which is indexed by compile-time error number, is
373      case PCRE_ERROR_NOMATCH: return REG_NOMATCH;    not the correct length. It seems to be the only way to do such a check at
374      case PCRE_ERROR_NULL: return REG_INVARG;    compile time, as the sizeof() operator does not work in the C preprocessor.
375      case PCRE_ERROR_BADOPTION: return REG_INVARG;    As all the PCRE_ERROR_xxx values are negative, we can use 0 and 1. */
376      case PCRE_ERROR_BADMAGIC: return REG_INVARG;  
377      case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT;    case 0:
378      case PCRE_ERROR_NOMEMORY: return REG_ESPACE;    case (sizeof(eint)/sizeof(int) == ERRCOUNT):
379      case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;    return REG_ASSERT;
380      case PCRE_ERROR_BADUTF8: return REG_INVARG;  /* ========================================================================== */
381      case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;  
382      default: return REG_ASSERT;    case PCRE_ERROR_NOMATCH: return REG_NOMATCH;
383      }    case PCRE_ERROR_NULL: return REG_INVARG;
384      case PCRE_ERROR_BADOPTION: return REG_INVARG;
385      case PCRE_ERROR_BADMAGIC: return REG_INVARG;
386      case PCRE_ERROR_UNKNOWN_NODE: return REG_ASSERT;
387      case PCRE_ERROR_NOMEMORY: return REG_ESPACE;
388      case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;
389      case PCRE_ERROR_BADUTF8: return REG_INVARG;
390      case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;
391      default: return REG_ASSERT;
392    }    }
393  }  }
394    

Legend:
Removed from v.498  
changed lines
  Added in v.499

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12