# HG changeset patch # User Paul Eggert # Date 1357086466 28800 # Node ID 28b073aabf32cf0e23f8b37959de20c084aa9ab8 # Parent 83362ee4d2246e54e5847ce0ce0cbf05da2133a8 regex: omit needless signed-pointer casts * lib/regcomp.c (build_charclass, build_charclass_op): Use char *, not unsigned char *, for class name and extra. The char values are always nonnegative so there's no need to insist on unsigned char * here, and using char * removes the need for casts. Reported by Aharon Robbins in . diff -r 83362ee4d224 -r 28b073aabf32 ChangeLog --- a/ChangeLog Tue Jan 01 16:05:43 2013 -0800 +++ b/ChangeLog Tue Jan 01 16:27:46 2013 -0800 @@ -1,5 +1,13 @@ 2013-01-01 Paul Eggert + regex: omit needless signed-pointer casts + * lib/regcomp.c (build_charclass, build_charclass_op): + Use char *, not unsigned char *, for class name and extra. + The char values are always nonnegative so there's no need to + insist on unsigned char * here, and using char * removes the need + for casts. Reported by Aharon Robbins in + . + regex: support Gawk, which never uses alloca * lib/regex_internal.h [!_LIBC && !HAVE_ALLOCA]: Do not include in this case. Gawk doesn't supply a substitute diff -r 83362ee4d224 -r 28b073aabf32 lib/regcomp.c --- a/lib/regcomp.c Tue Jan 01 16:05:43 2013 -0800 +++ b/lib/regcomp.c Tue Jan 01 16:27:46 2013 -0800 @@ -94,20 +94,20 @@ bitset_t sbcset, re_charset_t *mbcset, Idx *char_class_alloc, - const unsigned char *class_name, + const char *class_name, reg_syntax_t syntax); #else /* not RE_ENABLE_I18N */ static reg_errcode_t build_equiv_class (bitset_t sbcset, const unsigned char *name); static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, - const unsigned char *class_name, + const char *class_name, reg_syntax_t syntax); #endif /* not RE_ENABLE_I18N */ static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, - const unsigned char *class_name, - const unsigned char *extra, + const char *class_name, + const char *extra, bool non_match, reg_errcode_t *err); static bin_tree_t *create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, @@ -2422,8 +2422,8 @@ case OP_WORD: case OP_NOTWORD: tree = build_charclass_op (dfa, regexp->trans, - (const unsigned char *) "alnum", - (const unsigned char *) "_", + "alnum", + "_", token->type == OP_NOTWORD, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -2431,8 +2431,8 @@ case OP_SPACE: case OP_NOTSPACE: tree = build_charclass_op (dfa, regexp->trans, - (const unsigned char *) "space", - (const unsigned char *) "", + "space", + "", token->type == OP_NOTSPACE, err); if (BE (*err != REG_NOERROR && tree == NULL, 0)) return NULL; @@ -3571,14 +3571,14 @@ #ifdef RE_ENABLE_I18N build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, re_charset_t *mbcset, Idx *char_class_alloc, - const unsigned char *class_name, reg_syntax_t syntax) + const char *class_name, reg_syntax_t syntax) #else /* not RE_ENABLE_I18N */ build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, - const unsigned char *class_name, reg_syntax_t syntax) + const char *class_name, reg_syntax_t syntax) #endif /* not RE_ENABLE_I18N */ { int i; - const char *name = (const char *) class_name; + const char *name = class_name; /* In case of REG_ICASE "upper" and "lower" match the both of upper and lower cases. */ @@ -3652,8 +3652,8 @@ static bin_tree_t * build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, - const unsigned char *class_name, - const unsigned char *extra, bool non_match, + const char *class_name, + const char *extra, bool non_match, reg_errcode_t *err) { re_bitset_ptr_t sbcset;