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):
|
||||
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)
|
||||
{
|
||||
static const PosixBracketEntryType PBS[] = {
|
||||
{ (UChar* )"Alnum", ONIGENC_CTYPE_ALNUM, 5 },
|
||||
{ (UChar* )"Alpha", ONIGENC_CTYPE_ALPHA, 5 },
|
||||
{ (UChar* )"Blank", ONIGENC_CTYPE_BLANK, 5 },
|
||||
{ (UChar* )"Cntrl", ONIGENC_CTYPE_CNTRL, 5 },
|
||||
{ (UChar* )"Digit", ONIGENC_CTYPE_DIGIT, 5 },
|
||||
{ (UChar* )"Graph", ONIGENC_CTYPE_GRAPH, 5 },
|
||||
{ (UChar* )"Lower", ONIGENC_CTYPE_LOWER, 5 },
|
||||
{ (UChar* )"Print", ONIGENC_CTYPE_PRINT, 5 },
|
||||
{ (UChar* )"Punct", ONIGENC_CTYPE_PUNCT, 5 },
|
||||
{ (UChar* )"Space", ONIGENC_CTYPE_SPACE, 5 },
|
||||
{ (UChar* )"Upper", ONIGENC_CTYPE_UPPER, 5 },
|
||||
{ (UChar* )"XDigit", ONIGENC_CTYPE_XDIGIT, 6 },
|
||||
{ (UChar* )"ASCII", ONIGENC_CTYPE_ASCII, 5 },
|
||||
{ (UChar* )"Word", ONIGENC_CTYPE_WORD, 4 },
|
||||
{ (UChar* )NULL, -1, 0 }
|
||||
PosixBracketEntryInit("Alnum", ONIGENC_CTYPE_ALNUM),
|
||||
PosixBracketEntryInit("Alpha", ONIGENC_CTYPE_ALPHA),
|
||||
PosixBracketEntryInit("Blank", ONIGENC_CTYPE_BLANK),
|
||||
PosixBracketEntryInit("Cntrl", ONIGENC_CTYPE_CNTRL),
|
||||
PosixBracketEntryInit("Digit", ONIGENC_CTYPE_DIGIT),
|
||||
PosixBracketEntryInit("Graph", ONIGENC_CTYPE_GRAPH),
|
||||
PosixBracketEntryInit("Lower", ONIGENC_CTYPE_LOWER),
|
||||
PosixBracketEntryInit("Print", ONIGENC_CTYPE_PRINT),
|
||||
PosixBracketEntryInit("Punct", ONIGENC_CTYPE_PUNCT),
|
||||
PosixBracketEntryInit("Space", ONIGENC_CTYPE_SPACE),
|
||||
PosixBracketEntryInit("Upper", ONIGENC_CTYPE_UPPER),
|
||||
PosixBracketEntryInit("XDigit", ONIGENC_CTYPE_XDIGIT),
|
||||
PosixBracketEntryInit("ASCII", ONIGENC_CTYPE_ASCII),
|
||||
PosixBracketEntryInit("Word", ONIGENC_CTYPE_WORD),
|
||||
};
|
||||
|
||||
const PosixBracketEntryType *pb;
|
||||
const PosixBracketEntryType *pb, *pbe;
|
||||
int len;
|
||||
|
||||
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 &&
|
||||
onigenc_with_ascii_strncmp(enc, p, end, pb->name, pb->len) == 0)
|
||||
return pb->ctype;
|
||||
|
|
3
regenc.h
3
regenc.h
|
@ -96,11 +96,12 @@ typedef struct {
|
|||
|
||||
|
||||
typedef struct {
|
||||
UChar *name;
|
||||
const UChar *name;
|
||||
int ctype;
|
||||
short int len;
|
||||
} PosixBracketEntryType;
|
||||
|
||||
#define PosixBracketEntryInit(name, ctype) {(const UChar *)name, ctype, (short int)(sizeof(name) - 1)}
|
||||
|
||||
/* #define USE_CRNL_AS_LINE_TERMINATOR */
|
||||
#define USE_UNICODE_PROPERTIES
|
||||
|
|
Loading…
Add table
Reference in a new issue