Re: regcomp warnings using Mingw64 toolchain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/17/2012 07:00 AM, Bruno Haible wrote:
> For portability the cast to 'long' should better be replaced with a cast
> to 'intptr_t'.

Thanks, I did that, except I used uintptr_t since the value in
question is a size_t value.

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>.
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 7996dc0..7eb003b 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;

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]