Source

perlxs / test.c

Full commit
/*
 * This file was generated automatically by xsubpp version 1.9508 from the
 * contents of test.xs. Do not edit this file, edit test.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "test.xs"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include "ppport.h"

#include <stdlib.h>

char** test_func(int a, int* b);

#line 21 "test.c"

XS(XS_test_testfunc); /* prototype to pass -Wmissing-prototypes */
XS(XS_test_testfunc)
{
    dXSARGS;
    if (items != 2)
	Perl_croak(aTHX_ "Usage: test::testfunc(a, b)");
    SP -= items;
    {
	int	a = (int)SvIV(ST(0));
	int	b = (int)SvIV(ST(1));
#line 18 "test.xs"
        char **string_list;
        char **str;
        int len;

#line 38 "test.c"
	SV *	RETVAL;
#line 23 "test.xs"
        string_list = test_func(a, &b);
        if (string_list != NULL) {
            for (len = 0; string_list[len] != NULL; len += 1);

            EXTEND(SP, len);
            for (str = string_list; *str != NULL; str += 1) {
                PUSHs(newSVpv(*str, 0));
                free(*str);
            }
            free(string_list);
        }
#line 52 "test.c"
	PUTBACK;
	return;
    }
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_test); /* prototype to pass -Wmissing-prototypes */
XS(boot_test)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXS("test::testfunc", XS_test_testfunc, file);
    XSRETURN_YES;
}