summaryrefslogtreecommitdiff
path: root/regex
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>1999-12-28 20:50:34 +0000
committerSascha Schumann <sas@php.net>1999-12-28 20:50:34 +0000
commitaec0bb339b439a41cc0ac0db06a609b28ad32a7e (patch)
treedb11ef3da3f10d1c36fed4f858d470125b7291ca /regex
parent32ef59b290899e229556c159036280b80186260c (diff)
downloadphp-git-aec0bb339b439a41cc0ac0db06a609b28ad32a7e.tar.gz
Fix -Wall warnings
Diffstat (limited to 'regex')
-rw-r--r--regex/cclass.h43
-rw-r--r--regex/cname.h192
-rw-r--r--regex/regcomp.c9
-rw-r--r--regex/regcomp.ih2
-rw-r--r--regex/regerror.c36
5 files changed, 143 insertions, 139 deletions
diff --git a/regex/cclass.h b/regex/cclass.h
index 0c293028e9..6227f810b7 100644
--- a/regex/cclass.h
+++ b/regex/cclass.h
@@ -4,28 +4,27 @@ static struct cclass {
char *chars;
char *multis;
} cclasses[] = {
- "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789", "",
- "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
- "",
- "blank", " \t", "",
- "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
-\25\26\27\30\31\32\33\34\35\36\37\177", "",
- "digit", "0123456789", "",
- "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
+ {"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ""},
+ {"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
+ ""},
+ {"blank", " \t", ""},
+ {"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
+\25\26\27\30\31\32\33\34\35\36\37\177", ""},
+ {"digit", "0123456789", ""},
+ {"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- "",
- "lower", "abcdefghijklmnopqrstuvwxyz",
- "",
- "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
+ ""},
+ {"lower", "abcdefghijklmnopqrstuvwxyz",
+ ""},
+ {"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
- "",
- "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
- "",
- "space", "\t\n\v\f\r ", "",
- "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
- "",
- "xdigit", "0123456789ABCDEFabcdef",
- "",
- NULL, 0, ""
+ ""},
+ {"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
+ ""},
+ {"space", "\t\n\v\f\r ", ""},
+ {"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+ ""},
+ {"xdigit", "0123456789ABCDEFabcdef",
+ ""},
+ {NULL, 0, ""}
};
diff --git a/regex/cname.h b/regex/cname.h
index 02e86e912e..670b273882 100644
--- a/regex/cname.h
+++ b/regex/cname.h
@@ -3,100 +3,100 @@ static struct cname {
char *name;
char code;
} cnames[] = {
- "NUL", '\0',
- "SOH", '\001',
- "STX", '\002',
- "ETX", '\003',
- "EOT", '\004',
- "ENQ", '\005',
- "ACK", '\006',
- "BEL", '\007',
- "alert", '\007',
- "BS", '\010',
- "backspace", '\b',
- "HT", '\011',
- "tab", '\t',
- "LF", '\012',
- "newline", '\n',
- "VT", '\013',
- "vertical-tab", '\v',
- "FF", '\014',
- "form-feed", '\f',
- "CR", '\015',
- "carriage-return", '\r',
- "SO", '\016',
- "SI", '\017',
- "DLE", '\020',
- "DC1", '\021',
- "DC2", '\022',
- "DC3", '\023',
- "DC4", '\024',
- "NAK", '\025',
- "SYN", '\026',
- "ETB", '\027',
- "CAN", '\030',
- "EM", '\031',
- "SUB", '\032',
- "ESC", '\033',
- "IS4", '\034',
- "FS", '\034',
- "IS3", '\035',
- "GS", '\035',
- "IS2", '\036',
- "RS", '\036',
- "IS1", '\037',
- "US", '\037',
- "space", ' ',
- "exclamation-mark", '!',
- "quotation-mark", '"',
- "number-sign", '#',
- "dollar-sign", '$',
- "percent-sign", '%',
- "ampersand", '&',
- "apostrophe", '\'',
- "left-parenthesis", '(',
- "right-parenthesis", ')',
- "asterisk", '*',
- "plus-sign", '+',
- "comma", ',',
- "hyphen", '-',
- "hyphen-minus", '-',
- "period", '.',
- "full-stop", '.',
- "slash", '/',
- "solidus", '/',
- "zero", '0',
- "one", '1',
- "two", '2',
- "three", '3',
- "four", '4',
- "five", '5',
- "six", '6',
- "seven", '7',
- "eight", '8',
- "nine", '9',
- "colon", ':',
- "semicolon", ';',
- "less-than-sign", '<',
- "equals-sign", '=',
- "greater-than-sign", '>',
- "question-mark", '?',
- "commercial-at", '@',
- "left-square-bracket", '[',
- "backslash", '\\',
- "reverse-solidus", '\\',
- "right-square-bracket", ']',
- "circumflex", '^',
- "circumflex-accent", '^',
- "underscore", '_',
- "low-line", '_',
- "grave-accent", '`',
- "left-brace", '{',
- "left-curly-bracket", '{',
- "vertical-line", '|',
- "right-brace", '}',
- "right-curly-bracket", '}',
- "tilde", '~',
- "DEL", '\177',
- NULL, 0,
+ {"NUL", '\0'},
+ {"SOH", '\001'},
+ {"STX", '\002'},
+ {"ETX", '\003'},
+ {"EOT", '\004'},
+ {"ENQ", '\005'},
+ {"ACK", '\006'},
+ {"BEL", '\007'},
+ {"alert", '\007'},
+ {"BS", '\010'},
+ {"backspace", '\b'},
+ {"HT", '\011'},
+ {"tab", '\t'},
+ {"LF", '\012'},
+ {"newline", '\n'},
+ {"VT", '\013'},
+ {"vertical-tab", '\v'},
+ {"FF", '\014'},
+ {"form-feed", '\f'},
+ {"CR", '\015'},
+ {"carriage-return", '\r'},
+ {"SO", '\016'},
+ {"SI", '\017'},
+ {"DLE", '\020'},
+ {"DC1", '\021'},
+ {"DC2", '\022'},
+ {"DC3", '\023'},
+ {"DC4", '\024'},
+ {"NAK", '\025'},
+ {"SYN", '\026'},
+ {"ETB", '\027'},
+ {"CAN", '\030'},
+ {"EM", '\031'},
+ {"SUB", '\032'},
+ {"ESC", '\033'},
+ {"IS4", '\034'},
+ {"FS", '\034'},
+ {"IS3", '\035'},
+ {"GS", '\035'},
+ {"IS2", '\036'},
+ {"RS", '\036'},
+ {"IS1", '\037'},
+ {"US", '\037'},
+ {"space", ' '},
+ {"exclamation-mark", '!'},
+ {"quotation-mark", '"'},
+ {"number-sign", '#'},
+ {"dollar-sign", '$'},
+ {"percent-sign", '%'},
+ {"ampersand", '&'},
+ {"apostrophe", '\''},
+ {"left-parenthesis", '('},
+ {"right-parenthesis", ')'},
+ {"asterisk", '*'},
+ {"plus-sign", '+'},
+ {"comma", ','},
+ {"hyphen", '-'},
+ {"hyphen-minus", '-'},
+ {"period", '.'},
+ {"full-stop", '.'},
+ {"slash", '/'},
+ {"solidus", '/'},
+ {"zero", '0'},
+ {"one", '1'},
+ {"two", '2'},
+ {"three", '3'},
+ {"four", '4'},
+ {"five", '5'},
+ {"six", '6'},
+ {"seven", '7'},
+ {"eight", '8'},
+ {"nine", '9'},
+ {"colon", ':'},
+ {"semicolon", ';'},
+ {"less-than-sign", '<'},
+ {"equals-sign", '='},
+ {"greater-than-sign", '>'},
+ {"question-mark", '?'},
+ {"commercial-at", '@'},
+ {"left-square-bracket", '['},
+ {"backslash", '\\'},
+ {"reverse-solidus", '\\'},
+ {"right-square-bracket", ']'},
+ {"circumflex", '^'},
+ {"circumflex-accent", '^'},
+ {"underscore", '_'},
+ {"low-line", '_'},
+ {"grave-accent", '`'},
+ {"left-brace", '{'},
+ {"left-curly-bracket", '{'},
+ {"vertical-line", '|'},
+ {"right-brace", '}'},
+ {"right-curly-bracket", '}'},
+ {"tilde", '~'},
+ {"DEL", '\177'},
+ {NULL, 0},
};
diff --git a/regex/regcomp.c b/regex/regcomp.c
index 2569b1c629..0b939461bd 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -4,11 +4,11 @@
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
-#include <regex.h>
#define POSIX_MISTAKE
#include "utils.h"
+#include "regex.h"
#include "regex2.h"
#include "cclass.h"
@@ -53,7 +53,7 @@ static char nuls[10]; /* place to point scanner in event of error */
#define NEXTn(n) (p->next += (n))
#define GETNEXT() (*p->next++)
#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) ((co) || SETERROR(e))
+#define REQUIRE(co, e) (void) ((co) || SETERROR(e))
#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
@@ -204,7 +204,7 @@ int stop; /* character this ERE should end at */
conc = HERE();
while (MORE() && (c = PEEK()) != '|' && c != stop)
p_ere_exp(p);
- REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
+ (void) REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
if (!EAT('|'))
break; /* NOTE BREAK OUT */
@@ -1171,6 +1171,7 @@ register char *cp;
cs->multis[cs->smultis - 1] = '\0';
}
+#if 0
/*
- mcsub - subtract a collating element from a cset
== static void mcsub(register cset *cs, register char *cp);
@@ -1210,6 +1211,7 @@ register char *cp;
return(mcfind(cs, cp) != NULL);
}
+
/*
- mcfind - find a collating element in a cset
== static char *mcfind(register cset *cs, register char *cp);
@@ -1228,6 +1230,7 @@ register char *cp;
return(p);
return(NULL);
}
+#endif
/*
- mcinvert - invert the list of collating elements in a cset
diff --git a/regex/regcomp.ih b/regex/regcomp.ih
index 0776e7185c..6efafebf60 100644
--- a/regex/regcomp.ih
+++ b/regex/regcomp.ih
@@ -28,9 +28,11 @@ static int freezeset(register struct parse *p, register cset *cs);
static int firstch(register struct parse *p, register cset *cs);
static int nch(register struct parse *p, register cset *cs);
static void mcadd(register struct parse *p, register cset *cs, register char *cp);
+#if 0
static void mcsub(register cset *cs, register char *cp);
static int mcin(register cset *cs, register char *cp);
static char *mcfind(register cset *cs, register char *cp);
+#endif
static void mcinvert(register struct parse *p, register cset *cs);
static void mccase(register struct parse *p, register cset *cs);
static int isinsets(register struct re_guts *g, int c);
diff --git a/regex/regerror.c b/regex/regerror.c
index 9158870322..bf71e3a814 100644
--- a/regex/regerror.c
+++ b/regex/regerror.c
@@ -35,24 +35,24 @@ static struct rerr {
char *name;
char *explain;
} rerrs[] = {
- REG_OKAY, "REG_OKAY", "no errors detected",
- REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match",
- REG_BADPAT, "REG_BADPAT", "invalid regular expression",
- REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element",
- REG_ECTYPE, "REG_ECTYPE", "invalid character class",
- REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)",
- REG_ESUBREG, "REG_ESUBREG", "invalid backreference number",
- REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced",
- REG_EPAREN, "REG_EPAREN", "parentheses not balanced",
- REG_EBRACE, "REG_EBRACE", "braces not balanced",
- REG_BADBR, "REG_BADBR", "invalid repetition count(s)",
- REG_ERANGE, "REG_ERANGE", "invalid character range",
- REG_ESPACE, "REG_ESPACE", "out of memory",
- REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid",
- REG_EMPTY, "REG_EMPTY", "empty (sub)expression",
- REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug",
- REG_INVARG, "REG_INVARG", "invalid argument to regex routine",
- -1, "", "*** unknown regexp error code ***",
+ {REG_OKAY, "REG_OKAY", "no errors detected"},
+ {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
+ {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
+ {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
+ {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
+ {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
+ {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
+ {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
+ {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
+ {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
+ {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
+ {REG_ERANGE, "REG_ERANGE", "invalid character range"},
+ {REG_ESPACE, "REG_ESPACE", "out of memory"},
+ {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
+ {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
+ {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
+ {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
+ {-1, "", "*** unknown regexp error code ***"},
};
/*