From 3a4836d1fa061adf7b2f96fbda9c2345e6210732 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 17 Jun 2012 09:55:15 -0700 Subject: [PATCH] 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 and fix suggested by Bruno Haible in . --- ChangeLog | 10 ++++++++++ lib/regcomp.c | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55dacfc2b..e04138c49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-06-17 Paul Eggert + + 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 + + and fix suggested by Bruno Haible in + . + 2012-06-17 Bruno Haible dummy: Relicense into the public domain. diff --git a/lib/regcomp.c b/lib/regcomp.c index 7996dc0b0..7eb003bfa 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -2621,7 +2621,10 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa, 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 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, 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; -- 2.11.0