mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* regenc.h (PosixBracketEntryType): constified.
* regenc.h (PosixBracketEntryInit): suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
01f3f86472
commit
46970b2d1d
3 changed files with 23 additions and 19 deletions
|
@ -1,4 +1,8 @@
|
||||||
Tue Sep 22 16:27:49 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Sep 22 16:28:41 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* regenc.h (PosixBracketEntryType): constified.
|
||||||
|
|
||||||
|
* regenc.h (PosixBracketEntryInit): suppress warnings.
|
||||||
|
|
||||||
* regerror.c (onig_error_code_to_str, onig_snprintf_with_pattern):
|
* regerror.c (onig_error_code_to_str, onig_snprintf_with_pattern):
|
||||||
fixed type.
|
fixed type.
|
||||||
|
|
33
regenc.c
33
regenc.c
|
@ -789,28 +789,27 @@ extern int
|
||||||
onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
||||||
{
|
{
|
||||||
static const PosixBracketEntryType PBS[] = {
|
static const PosixBracketEntryType PBS[] = {
|
||||||
{ (UChar* )"Alnum", ONIGENC_CTYPE_ALNUM, 5 },
|
PosixBracketEntryInit("Alnum", ONIGENC_CTYPE_ALNUM),
|
||||||
{ (UChar* )"Alpha", ONIGENC_CTYPE_ALPHA, 5 },
|
PosixBracketEntryInit("Alpha", ONIGENC_CTYPE_ALPHA),
|
||||||
{ (UChar* )"Blank", ONIGENC_CTYPE_BLANK, 5 },
|
PosixBracketEntryInit("Blank", ONIGENC_CTYPE_BLANK),
|
||||||
{ (UChar* )"Cntrl", ONIGENC_CTYPE_CNTRL, 5 },
|
PosixBracketEntryInit("Cntrl", ONIGENC_CTYPE_CNTRL),
|
||||||
{ (UChar* )"Digit", ONIGENC_CTYPE_DIGIT, 5 },
|
PosixBracketEntryInit("Digit", ONIGENC_CTYPE_DIGIT),
|
||||||
{ (UChar* )"Graph", ONIGENC_CTYPE_GRAPH, 5 },
|
PosixBracketEntryInit("Graph", ONIGENC_CTYPE_GRAPH),
|
||||||
{ (UChar* )"Lower", ONIGENC_CTYPE_LOWER, 5 },
|
PosixBracketEntryInit("Lower", ONIGENC_CTYPE_LOWER),
|
||||||
{ (UChar* )"Print", ONIGENC_CTYPE_PRINT, 5 },
|
PosixBracketEntryInit("Print", ONIGENC_CTYPE_PRINT),
|
||||||
{ (UChar* )"Punct", ONIGENC_CTYPE_PUNCT, 5 },
|
PosixBracketEntryInit("Punct", ONIGENC_CTYPE_PUNCT),
|
||||||
{ (UChar* )"Space", ONIGENC_CTYPE_SPACE, 5 },
|
PosixBracketEntryInit("Space", ONIGENC_CTYPE_SPACE),
|
||||||
{ (UChar* )"Upper", ONIGENC_CTYPE_UPPER, 5 },
|
PosixBracketEntryInit("Upper", ONIGENC_CTYPE_UPPER),
|
||||||
{ (UChar* )"XDigit", ONIGENC_CTYPE_XDIGIT, 6 },
|
PosixBracketEntryInit("XDigit", ONIGENC_CTYPE_XDIGIT),
|
||||||
{ (UChar* )"ASCII", ONIGENC_CTYPE_ASCII, 5 },
|
PosixBracketEntryInit("ASCII", ONIGENC_CTYPE_ASCII),
|
||||||
{ (UChar* )"Word", ONIGENC_CTYPE_WORD, 4 },
|
PosixBracketEntryInit("Word", ONIGENC_CTYPE_WORD),
|
||||||
{ (UChar* )NULL, -1, 0 }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const PosixBracketEntryType *pb;
|
const PosixBracketEntryType *pb, *pbe;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = onigenc_strlen(enc, p, end);
|
len = onigenc_strlen(enc, p, end);
|
||||||
for (pb = PBS; IS_NOT_NULL(pb->name); pb++) {
|
for (pbe = (pb = PBS) + sizeof(PBS)/sizeof(PBS[0]); pb < pbe; ++pb) {
|
||||||
if (len == pb->len &&
|
if (len == pb->len &&
|
||||||
onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0)
|
onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0)
|
||||||
return pb->ctype;
|
return pb->ctype;
|
||||||
|
|
3
regenc.h
3
regenc.h
|
@ -96,11 +96,12 @@ typedef struct {
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UChar *name;
|
const UChar *name;
|
||||||
int ctype;
|
int ctype;
|
||||||
short int len;
|
short int len;
|
||||||
} PosixBracketEntryType;
|
} PosixBracketEntryType;
|
||||||
|
|
||||||
|
#define PosixBracketEntryInit(name, ctype) {(const UChar *)name, ctype, (short int)(sizeof(name) - 1)}
|
||||||
|
|
||||||
/* #define USE_CRNL_AS_LINE_TERMINATOR */
|
/* #define USE_CRNL_AS_LINE_TERMINATOR */
|
||||||
#define USE_UNICODE_PROPERTIES
|
#define USE_UNICODE_PROPERTIES
|
||||||
|
|
Loading…
Add table
Reference in a new issue