From: Martin H. <mh...@us...> - 2005-09-30 11:06:38
|
Update of /cvsroot/opengtoolkit/serial/c_source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18474/c_source Modified Files: pcre.h pcre_compile.c pcre_globals.c Log Message: Changed to PCRE 6.2 Index: pcre.h =================================================================== RCS file: /cvsroot/opengtoolkit/serial/c_source/pcre.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pcre.h 23 Jul 2005 08:35:30 -0000 1.2 --- pcre.h 30 Sep 2005 11:06:29 -0000 1.3 *************** *** 44,49 **** #define PCRE_MAJOR 6 ! #define PCRE_MINOR 1 ! #define PCRE_DATE 21-Jun-2005 /* Win32 uses DLL by default; it needs special stuff for exported functions. */ --- 44,49 ---- #define PCRE_MAJOR 6 ! #define PCRE_MINOR 2 ! #define PCRE_DATE 01-Aug-2005 /* Win32 uses DLL by default; it needs special stuff for exported functions. */ *************** *** 238,241 **** --- 238,242 ---- PCRE_DATA_SCOPE void pcre_free_substring(const char *); PCRE_DATA_SCOPE void pcre_free_substring_list(const char **); + PCRE_DATA_SCOPE void pcre_free_regex(const pcre *re); PCRE_DATA_SCOPE int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); Index: pcre_compile.c =================================================================== RCS file: /cvsroot/opengtoolkit/serial/c_source/pcre_compile.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pcre_compile.c 23 Jul 2005 08:35:30 -0000 1.1 --- pcre_compile.c 30 Sep 2005 11:06:29 -0000 1.2 *************** *** 699,703 **** --- 699,714 ---- int max = -1; + /* Read the minimum value and do a paranoid check: a negative value indicates + an integer overflow. */ + while ((digitab[*p] & ctype_digit) != 0) min = min * 10 + *p++ - '0'; + if (min < 0 || min > 65535) + { + *errorcodeptr = ERR5; + return p; + } + + /* Read the maximum value if there is one, and again do a paranoid on its size. + Also, max must not be less than min. */ if (*p == '}') max = min; else *************** *** 707,710 **** --- 718,726 ---- max = 0; while((digitab[*p] & ctype_digit) != 0) max = max * 10 + *p++ - '0'; + if (max < 0 || max > 65535) + { + *errorcodeptr = ERR5; + return p; + } if (max < min) { *************** *** 715,728 **** } ! /* Do paranoid checks, then fill in the required variables, and pass back the ! pointer to the terminating '}'. */ ! if (min > 65535 || max > 65535) ! *errorcodeptr = ERR5; ! else ! { ! *minp = min; ! *maxp = max; ! } return p; } --- 731,739 ---- } ! /* Fill in the required variables, and pass back the pointer to the terminating ! '}'. */ ! *minp = min; ! *maxp = max; return p; } *************** *** 3857,3860 **** --- 3868,3872 ---- #endif BOOL inescq = FALSE; + BOOL capturing; unsigned int brastackptr = 0; size_t size; *************** *** 4411,4414 **** --- 4423,4427 ---- branch_newextra = 0; bracket_length = 1 + LINK_SIZE; + capturing = FALSE; /* Handle special forms of bracket, which all start (? */ *************** *** 4498,4501 **** --- 4511,4517 ---- case 'P': ptr += 3; + + /* Handle the definition of a named subpattern */ + if (*ptr == '<') { *************** *** 4510,4516 **** --- 4526,4535 ---- name_count++; if (ptr - p > max_name_size) max_name_size = (ptr - p); + capturing = TRUE; /* Named parentheses are always capturing */ break; } + /* Handle back references and recursive calls to named subpatterns */ + if (*ptr == '=' || *ptr == '>') { *************** *** 4696,4711 **** } ! /* If options were terminated by ':' control comes here. Fall through ! to handle the group below. */ } } ! /* Extracting brackets must be counted so we can process escapes in a ! Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to ! need an additional 3 bytes of store per extracting bracket. However, if ! PCRE_NO_AUTO)CAPTURE is set, unadorned brackets become non-capturing, so we ! must leave the count alone (it will aways be zero). */ ! else if ((options & PCRE_NO_AUTO_CAPTURE) == 0) { bracount++; --- 4715,4736 ---- } ! /* If options were terminated by ':' control comes here. This is a ! non-capturing group with an options change. There is nothing more that ! needs to be done because "capturing" is already set FALSE by default; ! we can just fall through. */ ! } } ! /* Ordinary parentheses, not followed by '?', are capturing unless ! PCRE_NO_AUTO_CAPTURE is set. */ ! else capturing = (options & PCRE_NO_AUTO_CAPTURE) == 0; ! ! /* Capturing brackets must be counted so we can process escapes in a ! Perlish way. If the number exceeds EXTRACT_BASIC_MAX we are going to need ! an additional 3 bytes of memory per capturing bracket. */ ! ! if (capturing) { bracount++; Index: pcre_globals.c =================================================================== RCS file: /cvsroot/opengtoolkit/serial/c_source/pcre_globals.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pcre_globals.c 23 Jul 2005 08:35:30 -0000 1.1 --- pcre_globals.c 30 Sep 2005 11:06:29 -0000 1.2 *************** *** 67,69 **** --- 67,81 ---- #endif + /* This function is used by callers of the non labview interface + to free the memory of a compiled regular expression. + + Arguments: + re the compiled regex + + */ + PCRE_DATA_SCOPE void pcre_free_regex(const pcre *re) + { + pcre_free(re); + } + /* End of pcre_globals.c */ |