Mercurial > hg > octave-nkf > gnulib-hg
diff lib/regcomp.c @ 16912:1591c84dbb2d
regex: avoid warning when pointers are not long
* lib/regcomp.c (parse_dup_op, mark_opt_subexp): Cast between void *
and uintptr_t, not long, for portability to hosts where pointers and
long have different sizes. Issue noted by Daniel P. Berrange in
<http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00122.html>
and fix suggested by Bruno Haible in
<http://lists.gnu.org/archive/html/bug-gnulib/2012-06/msg00128.html>.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 17 Jun 2012 09:55:15 -0700 |
parents | 551fb0402288 |
children | 87796549f866 |
line wrap: on
line diff
--- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -2621,7 +2621,10 @@ old_tree = NULL; if (elem->token.type == SUBEXP) - postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx); + { + uintptr_t subidx = elem->token.opr.idx; + postorder (elem, mark_opt_subexp, (void *) subidx); + } tree = create_tree (dfa, elem, NULL, (end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT)); @@ -3856,7 +3859,7 @@ static reg_errcode_t mark_opt_subexp (void *extra, bin_tree_t *node) { - Idx idx = (Idx) (long) extra; + Idx idx = (uintptr_t) extra; if (node->token.type == SUBEXP && node->token.opr.idx == idx) node->token.opt_subexp = 1;