r15113 - gnucash/trunk/src - Add a custom SWIG typemap for wrapping a return value of (char *)NULL
Chris Shoemaker
chris at cvs.gnucash.org
Mon Nov 13 21:10:14 EST 2006
Author: chris
Date: 2006-11-13 21:10:14 -0500 (Mon, 13 Nov 2006)
New Revision: 15113
Trac: http://svn.gnucash.org/trac/changeset/15113
Modified:
gnucash/trunk/src/base-typemaps.i
Log:
Add a custom SWIG typemap for wrapping a return value of (char *)NULL
as an empty guile string.
Modified: gnucash/trunk/src/base-typemaps.i
===================================================================
--- gnucash/trunk/src/base-typemaps.i 2006-11-14 02:07:03 UTC (rev 15112)
+++ gnucash/trunk/src/base-typemaps.i 2006-11-14 02:10:14 UTC (rev 15113)
@@ -25,7 +25,12 @@
typedef char gchar;
%typemap(newfree) gchar * "g_free($1);"
-
+%typemap (out) char * {
+ $result = scm_makfrom0str((const char *)$1);
+ if (!SCM_NFALSEP($result)) {
+ $result = scm_makstr(0, 0);
+ }
+}
%typemap(in) GNCPrintAmountInfo "$1 = gnc_scm2printinfo($input);"
%typemap(out) GNCPrintAmountInfo "$result = gnc_printinfo2scm($1);"
More information about the gnucash-changes
mailing list