dlz_perl_callback_clientinfo.xs revision 3b9ba6bd74e2cbbc0f821e5483ebf46fa8c4d8de
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * Copyright (C) 2012 John Eaglesham
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * Permission to use, copy, modify, and distribute this software for any
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * purpose with or without fee is hereby granted, provided that the above
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * copyright notice and this permission notice appear in all copies.
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND JOHN EAGLESHAM
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * JOHN EAGLESHAM BE LIABLE FOR ANY SPECIAL, DIRECT,
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews/* And some XS code. */
44a966dff66061ac3f266c6b451a70733eb78e82Mark AndrewsMODULE = DLZ_Perl::clientinfo PACKAGE = DLZ_Perl::clientinfo
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews const char *ret;
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews if (!SvTRUE(opaque) || !SvIOK(opaque)) XSRETURN_EMPTY;
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * Safe, because Perl guarantees that an IV (the type we
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * pass into DLZ functions who pass it here) is able to
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews * hold a pointer.
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews ci = (dlz_perl_clientinfo_opaque *) SvIV(opaque);
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews if (wantarray == G_VOID || ci->methods == NULL ||
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrews XPUSHs(sv_2mortal(newSVpv(addr_buf, strlen(addr_buf))));