Subject: | Ubuntu: AutoXS.h:47: error: conflicting types for '_new_hashkey' |
It seems that Ubuntu's C compiler (Ubuntu 4.3.2-1ubuntu12) chokes on
AuthoXS.h file generated by AutoXS::Header:
$(PERL) -MAutoXS::Header -e AutoXS::Header::WriteAutoXSHeader
It looks like this:
# make
/usr/bin/perl -MAutoXS::Header -e AutoXS::Header::WriteAutoXSHeader
cc -c -I. -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -
pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -
O2 -g -DVERSION=\"1.01\" -DXS_VERSION=\"1.01\" -fPIC "-I/usr/lib/
perl/5.10/CORE" XSAccessor.c
In file included from XSAccessor.xs:7:
AutoXS.h:47: error: conflicting types for '_new_hashkey'
AutoXS.h:33: error: previous implicit declaration of '_new_hashkey' was
here
make: *** [XSAccessor.o] Error 1
I've attached a patch moving around _new_hashkey(). It passed make test.
PS. Maybe it should be go into AutoXS::Header report queue?
Subject: | AutoXS.h.patch |
--- AutoXS.h.orig 2009-05-17 00:38:48.000000000 +0200
+++ AutoXS.h 2009-05-17 00:39:19.000000000 +0200
@@ -16,6 +16,23 @@
unsigned int AutoXS_reverse_arrayindices_length = 0;
I32* AutoXS_reverse_arrayindices = NULL;
+/* this is private, call get_hashkey_index instead */
+I32 _new_hashkey() {
+ if (AutoXS_no_hashkeys == AutoXS_free_hashkey_no) {
+ unsigned int extend = 1 + AutoXS_no_hashkeys * 2;
+ /*printf("extending hashkey storage by %u\n", extend);*/
+ unsigned int oldsize = AutoXS_no_hashkeys * sizeof(autoxs_hashkey);
+ /*printf("previous data size %u\n", oldsize);*/
+ autoxs_hashkey* tmphashkeys =
+ (autoxs_hashkey*) malloc( oldsize + extend * sizeof(autoxs_hashkey) );
+ memcpy(tmphashkeys, AutoXS_hashkeys, oldsize);
+ free(AutoXS_hashkeys);
+ AutoXS_hashkeys = tmphashkeys;
+ AutoXS_no_hashkeys += extend;
+ }
+ return AutoXS_free_hashkey_no++;
+}
+
I32 get_hashkey_index(const char* key, const I32 len) {
/* init */
if (AutoXS_reverse_hashkeys == NULL)
@@ -43,24 +60,6 @@
return index;
}
-/* this is private, call get_hashkey_index instead */
-I32 _new_hashkey() {
- if (AutoXS_no_hashkeys == AutoXS_free_hashkey_no) {
- unsigned int extend = 1 + AutoXS_no_hashkeys * 2;
- /*printf("extending hashkey storage by %u\n", extend);*/
- unsigned int oldsize = AutoXS_no_hashkeys * sizeof(autoxs_hashkey);
- /*printf("previous data size %u\n", oldsize);*/
- autoxs_hashkey* tmphashkeys =
- (autoxs_hashkey*) malloc( oldsize + extend * sizeof(autoxs_hashkey) );
- memcpy(tmphashkeys, AutoXS_hashkeys, oldsize);
- free(AutoXS_hashkeys);
- AutoXS_hashkeys = tmphashkeys;
- AutoXS_no_hashkeys += extend;
- }
- return AutoXS_free_hashkey_no++;
-}
-
-
void _resize_array(I32** array, unsigned int* len, unsigned int newlen) {
unsigned int oldsize = *len * sizeof(I32);
I32* tmparraymap = (I32*) malloc( newlen * sizeof(I32) );