/[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 654 by ph10, Tue Aug 2 11:00:40 2011 UTC revision 1221 by ph10, Sun Nov 11 20:27:03 2012 UTC
# Line 6  Line 6 
6  and semantics are as close as possible to those of the Perl 5 language.  and semantics are as close as possible to those of the Perl 5 language.
7    
8                         Written by Philip Hazel                         Written by Philip Hazel
9             Copyright (c) 1997-2010 University of Cambridge             Copyright (c) 1997-2012 University of Cambridge
10    
11  -----------------------------------------------------------------------------  -----------------------------------------------------------------------------
12  Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
# Line 153  static const int eint[] = { Line 153  static const int eint[] = {
153    REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UCP support */    REG_INVARG,  /* this version of PCRE is not compiled with PCRE_UCP support */
154    REG_BADPAT,  /* \c must be followed by an ASCII character */    REG_BADPAT,  /* \c must be followed by an ASCII character */
155    REG_BADPAT,  /* \k is not followed by a braced, angle-bracketed, or quoted name */    REG_BADPAT,  /* \k is not followed by a braced, angle-bracketed, or quoted name */
156      /* 70 */
157      REG_BADPAT,  /* internal error: unknown opcode in find_fixedlength() */
158      REG_BADPAT,  /* \N is not supported in a class */
159      REG_BADPAT,  /* too many forward references */
160      REG_BADPAT,  /* disallowed UTF-8/16/32 code point (>= 0xd800 && <= 0xdfff) */
161      REG_BADPAT,  /* invalid UTF-16 string (should not occur) */
162      /* 75 */
163      REG_BADPAT,  /* overlong MARK name */
164      REG_BADPAT,  /* character value in \u.... sequence is too large */
165      REG_BADPAT   /* invalid UTF-32 string (should not occur) */
166  };  };
167    
168  /* Table of texts corresponding to POSIX error codes */  /* Table of texts corresponding to POSIX error codes */
# Line 223  return length + addlength; Line 233  return length + addlength;
233  PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION  PCREPOSIX_EXP_DEFN void PCRE_CALL_CONVENTION
234  regfree(regex_t *preg)  regfree(regex_t *preg)
235  {  {
236  (pcre_free)(preg->re_pcre);  (PUBL(free))(preg->re_pcre);
237  }  }
238    
239    
# Line 250  const char *errorptr; Line 260  const char *errorptr;
260  int erroffset;  int erroffset;
261  int errorcode;  int errorcode;
262  int options = 0;  int options = 0;
263    int re_nsub = 0;
264    
265  if ((cflags & REG_ICASE) != 0)    options |= PCRE_CASELESS;  if ((cflags & REG_ICASE) != 0)    options |= PCRE_CASELESS;
266  if ((cflags & REG_NEWLINE) != 0)  options |= PCRE_MULTILINE;  if ((cflags & REG_NEWLINE) != 0)  options |= PCRE_MULTILINE;
# Line 268  should not happen, but we all make mista Line 279  should not happen, but we all make mista
279    
280  if (preg->re_pcre == NULL)  if (preg->re_pcre == NULL)
281    {    {
282    return (errorcode < sizeof(eint)/sizeof(const int))?    return (errorcode < (int)(sizeof(eint)/sizeof(const int)))?
283      eint[errorcode] : REG_BADPAT;      eint[errorcode] : REG_BADPAT;
284    }    }
285    
286  preg->re_nsub = pcre_info((const pcre *)preg->re_pcre, NULL, NULL);  (void)pcre_fullinfo((const pcre *)preg->re_pcre, NULL, PCRE_INFO_CAPTURECOUNT,
287      &re_nsub);
288    preg->re_nsub = (size_t)re_nsub;
289  return 0;  return 0;
290  }  }
291    
# Line 304  int *ovector = NULL; Line 317  int *ovector = NULL;
317  int small_ovector[POSIX_MALLOC_THRESHOLD * 3];  int small_ovector[POSIX_MALLOC_THRESHOLD * 3];
318  BOOL allocated_ovector = FALSE;  BOOL allocated_ovector = FALSE;
319  BOOL nosub =  BOOL nosub =
320    (((const pcre *)preg->re_pcre)->options & PCRE_NO_AUTO_CAPTURE) != 0;    (REAL_PCRE_OPTIONS((const pcre *)preg->re_pcre) & PCRE_NO_AUTO_CAPTURE) != 0;
321    
322  if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;  if ((eflags & REG_NOTBOL) != 0) options |= PCRE_NOTBOL;
323  if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;  if ((eflags & REG_NOTEOL) != 0) options |= PCRE_NOTEOL;
# Line 398  switch(rc) Line 411  switch(rc)
411    case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;    case PCRE_ERROR_MATCHLIMIT: return REG_ESPACE;
412    case PCRE_ERROR_BADUTF8: return REG_INVARG;    case PCRE_ERROR_BADUTF8: return REG_INVARG;
413    case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;    case PCRE_ERROR_BADUTF8_OFFSET: return REG_INVARG;
414      case PCRE_ERROR_BADMODE: return REG_INVARG;
415    default: return REG_ASSERT;    default: return REG_ASSERT;
416    }    }
417  }  }

Legend:
Removed from v.654  
changed lines
  Added in v.1221

  ViewVC Help
Powered by ViewVC 1.1.5