perl: Fix generated XS code for value_dword binding.
authorRichard Jones <rjones@redhat.com>
Sun, 11 Jul 2010 22:32:14 +0000 (23:32 +0100)
committerRichard Jones <rjones@redhat.com>
Sun, 11 Jul 2010 22:32:14 +0000 (23:32 +0100)
Thanks to Hilko Bengen for spotting the problem.

generator/generator.ml

index 03f8c20..5bd46ee 100755 (executable)
@@ -2421,7 +2421,6 @@ DESTROY (h)
         | RErrDispose -> assert false
         | RHive -> assert false
 
-        | RInt32
         | RNode
         | RValue ->
              pr "PREINIT:\n";
@@ -2542,6 +2541,21 @@ DESTROY (h)
             pr "      PUSHs (sv_2mortal (newSVpvn (r, len)));\n";
             pr "      free (r);\n";
 
+        | RInt32 ->
+             pr "PREINIT:\n";
+             pr "      int32_t r;\n";
+             pr "   CODE:\n";
+            pr "      errno = 0;\n";
+             pr "      r = hivex_%s (%s);\n"
+              name (String.concat ", " c_params);
+            free_args ();
+             pr "      if (r == -1 && errno != 0)\n";
+             pr "        croak (\"%%s: %%s\", \"%s\", strerror (errno));\n"
+              name;
+             pr "      RETVAL = newSViv (r);\n";
+             pr " OUTPUT:\n";
+             pr "      RETVAL\n"
+
         | RInt64 ->
              pr "PREINIT:\n";
              pr "      int64_t r;\n";