version 1.1, 2012/02/21 23:50:25
|
version 1.1.1.2, 2013/07/22 08:25:55
|
Line 6
|
Line 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. |
|
|
Written by Philip Hazel |
Written by Philip Hazel |
Copyright (c) 1997-2012 University of Cambridge | Copyright (c) 1997-2013 University of Cambridge |
|
|
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 38 POSSIBILITY OF SUCH DAMAGE.
|
Line 38 POSSIBILITY OF SUCH DAMAGE.
|
*/ |
*/ |
|
|
|
|
/* This module contains an internal function that is used to match an extended | /* This module contains internal functions for comparing and finding the length |
class. It is used by both pcre_exec() and pcre_def_exec(). */ | of strings for different data item sizes. */ |
|
|
|
|
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
Line 54 class. It is used by both pcre_exec() and pcre_def_exe
|
Line 54 class. It is used by both pcre_exec() and pcre_def_exe
|
* Compare string utilities * |
* Compare string utilities * |
*************************************************/ |
*************************************************/ |
|
|
/* The following two functions compares two strings. Basically an strcmp | /* The following two functions compares two strings. Basically a strcmp |
for non 8 bit characters. |
for non 8 bit characters. |
|
|
Arguments: |
Arguments: |
Line 81 while (*str1 != '\0' || *str2 != '\0')
|
Line 81 while (*str1 != '\0' || *str2 != '\0')
|
return 0; |
return 0; |
} |
} |
|
|
|
#ifdef COMPILE_PCRE32 |
|
|
int |
int |
|
PRIV(strcmp_uc_uc_utf)(const pcre_uchar *str1, const pcre_uchar *str2) |
|
{ |
|
pcre_uchar c1; |
|
pcre_uchar c2; |
|
|
|
while (*str1 != '\0' || *str2 != '\0') |
|
{ |
|
c1 = RAWUCHARINC(str1); |
|
c2 = RAWUCHARINC(str2); |
|
if (c1 != c2) |
|
return ((c1 > c2) << 1) - 1; |
|
} |
|
/* Both length and characters must be equal. */ |
|
return 0; |
|
} |
|
|
|
#endif /* COMPILE_PCRE32 */ |
|
|
|
int |
PRIV(strcmp_uc_c8)(const pcre_uchar *str1, const char *str2) |
PRIV(strcmp_uc_c8)(const pcre_uchar *str1, const char *str2) |
{ |
{ |
const pcre_uint8 *ustr2 = (pcre_uint8 *)str2; |
const pcre_uint8 *ustr2 = (pcre_uint8 *)str2; |
Line 99 while (*str1 != '\0' || *ustr2 != '\0')
|
Line 120 while (*str1 != '\0' || *ustr2 != '\0')
|
return 0; |
return 0; |
} |
} |
|
|
|
#ifdef COMPILE_PCRE32 |
|
|
|
int |
|
PRIV(strcmp_uc_c8_utf)(const pcre_uchar *str1, const char *str2) |
|
{ |
|
const pcre_uint8 *ustr2 = (pcre_uint8 *)str2; |
|
pcre_uchar c1; |
|
pcre_uchar c2; |
|
|
|
while (*str1 != '\0' || *ustr2 != '\0') |
|
{ |
|
c1 = RAWUCHARINC(str1); |
|
c2 = (pcre_uchar)*ustr2++; |
|
if (c1 != c2) |
|
return ((c1 > c2) << 1) - 1; |
|
} |
|
/* Both length and characters must be equal. */ |
|
return 0; |
|
} |
|
|
|
#endif /* COMPILE_PCRE32 */ |
|
|
/* The following two functions compares two, fixed length |
/* The following two functions compares two, fixed length |
strings. Basically an strncmp for non 8 bit characters. |
strings. Basically an strncmp for non 8 bit characters. |
|
|
Line 163 while (*str++ != 0)
|
Line 206 while (*str++ != 0)
|
return len; |
return len; |
} |
} |
|
|
#endif /* COMPILE_PCRE8 */ | #endif /* !COMPILE_PCRE8 */ |
|
|
/* End of pcre_string_utils.c */ |
/* End of pcre_string_utils.c */ |