-/* $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"
ZOOM_resultset_size(r)
ZOOM_resultset r
-# TESTING
+# TESTED
SV *
ZOOM_resultset_records(r, start, count, return_values)
ZOOM_resultset r
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: