Subject: | Generated code should be C89 |
Came across this while building Class::XSAccessor with Visual C++ 9.0.
Attached patch moves the declaration to the beginning of blocks.
Subject: | decl.patch |
--- lib\AutoXS\Header.pm.orig Sun May 17 11:17:27 2009
+++ lib\AutoXS\Header.pm Sun May 31 17:33:53 2009
@@ -48,11 +48,13 @@
/* implementation section */
I32 get_hashkey_index(const char* key, const I32 len) {
+ I32 index;
+
/* init */
if (AutoXS_reverse_hashkeys == NULL)
AutoXS_reverse_hashkeys = newHV();
- I32 index = 0;
+ index = 0;
if ( hv_exists(AutoXS_reverse_hashkeys, key, len) ) {
SV** index_sv = hv_fetch(AutoXS_reverse_hashkeys, key, len, 0);
@@ -126,6 +128,8 @@
}
I32 get_internal_array_index(I32 object_ary_idx) {
+ I32 new_index;
+
if (AutoXS_reverse_arrayindices_length <= object_ary_idx)
_resize_array_init( &AutoXS_reverse_arrayindices,
&AutoXS_reverse_arrayindices_length,
@@ -135,7 +139,7 @@
if (AutoXS_reverse_arrayindices[object_ary_idx] > -1)
return AutoXS_reverse_arrayindices[object_ary_idx];
- I32 new_index = _new_internal_arrayindex();
+ new_index = _new_internal_arrayindex();
AutoXS_reverse_arrayindices[object_ary_idx] = new_index;
return new_index;
}