Fixed resultset_records()
authormike <mike>
Thu, 3 Nov 2005 15:58:09 +0000 (15:58 +0000)
committermike <mike>
Thu, 3 Nov 2005 15:58:09 +0000 (15:58 +0000)
ZOOM.xs

diff --git a/ZOOM.xs b/ZOOM.xs
index 557e4ed..7df5376 100644 (file)
--- a/ZOOM.xs
+++ b/ZOOM.xs
@@ -1,4 +1,4 @@
-/* $Id: ZOOM.xs,v 1.20 2005-11-02 18:23:10 mike Exp $ */
+/* $Id: ZOOM.xs,v 1.21 2005-11-03 15:58:09 mike Exp $ */
 
 #include "EXTERN.h"
 #include "perl.h"
@@ -250,7 +250,7 @@ size_t
 ZOOM_resultset_size(r)
        ZOOM_resultset r
 
-# TESTING
+# TESTED
 SV *
 ZOOM_resultset_records(r, start, count, return_values)
        ZOOM_resultset r
@@ -258,32 +258,21 @@ ZOOM_resultset_records(r, start, count, return_values)
        size_t count
        int return_values
        INIT:
-               ZOOM_record *recs;
+               ZOOM_record *recs = 0;
        CODE:
-               /*printf("*** ZOOM_resultset_records(r=0x%lx, start=%lu, count=%lx, return_values=%d)\n", (unsigned long) r, (unsigned long) start, (unsigned long) count, return_values);*/
-               if (return_values) {
-                       /*printf("*** generating space for %ld records\n", (unsigned long) count);*/
+               if (return_values)
                        recs = (ZOOM_record*) xmalloc(count * sizeof *recs);
-               } else {
-                       /*printf("*** using null pointer for records array\n");*/
-                       recs = 0;
-               }
                ZOOM_resultset_records(r, recs, start, count);
-               /*printf("*** returned from ZOOM_resultset_records()\n");*/
                if (return_values) {
                        AV *av = newAV();
                        int i;
                        for (i = 0; i < count; i++) {
-                               SV *tmp = sv_newmortal();
-                               printf("*** recs[%d] = %lu\n", i, (unsigned long) recs[i]);
-                               /* ### Next line fails.  Damn and blast Perl */
+                               SV *tmp = newSV(0);
                                sv_setref_pv(tmp, "ZOOM_record", (void*) recs[i]);
                                av_push(av, tmp);
                        }
                        RETVAL = newRV((SV*) av);
-                       printf("*** returning array %lu\n", (unsigned long) RETVAL);
                } else {
-                       /*printf("*** returning undef\n");*/
                        RETVAL = &PL_sv_undef;
                }
        OUTPUT: