Subject: | init_extension(RENDER) make_num_hash warnings |
Date: | Sat, 30 Apr 2011 06:57:50 +1000 |
To: | bug-X11-Protocol [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
When running "perl -w" with 5.10.1, make_num_hash() seems to print some
warnings for undefs in the arrays from X11::Protocol::Ext::RENDER,
perl -w -MX11::Protocol -e 'X11::Protocol->new->init_extension(q(RENDER))'
=>
Use of uninitialized value in hash slice at /usr/share/perl5/X11/Protocol.pm line 208.
Perhaps something like the following to allow enums like PictOp which
are a little bit sparse.
--- Protocol.pm.orig 2006-10-09 06:16:30.000000000 +1000
+++ Protocol.pm 2011-04-29 16:00:38.000000000 +1000
@@ -204,9 +204,7 @@
sub make_num_hash {
my($from) = @_;
- my(%hash);
- @hash{@$from} = (0 .. $#{$from});
- return %hash;
+ return map { defined $from->[$_] ? ($from->[$_]=>$_) : () } 0 .. $#$from;
}
sub num ($$) {