summaryrefslogtreecommitdiffstats
path: root/swig
diff options
context:
space:
mode:
authorChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-07 15:09:00 +0000
committerChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-07 15:09:00 +0000
commited0ad921339c04ae57f48e31be8d4d925585285a (patch)
tree82ec43249ab6bb516f0e2d8832c8b7d83ffbdd08 /swig
parent78e9a2b30fb31f2446e86c9cd0a43fd5ff33e4d8 (diff)
downloadlasso-ed0ad921339c04ae57f48e31be8d4d925585285a.tar.gz
lasso-ed0ad921339c04ae57f48e31be8d4d925585285a.tar.xz
lasso-ed0ad921339c04ae57f48e31be8d4d925585285a.zip
ZVAL_STRING macro for PHP
Diffstat (limited to 'swig')
-rw-r--r--swig/Lasso.i20
1 files changed, 20 insertions, 0 deletions
diff --git a/swig/Lasso.i b/swig/Lasso.i
index 5d4c5522..5f12e070 100644
--- a/swig/Lasso.i
+++ b/swig/Lasso.i
@@ -94,6 +94,7 @@
}
%}
#else
+
#ifdef SWIGPYTHON
%{
PyObject *lassoError;
@@ -141,6 +142,25 @@ SyntaxError = _lasso.SyntaxError
#endif
+#if defined(SWIGPHP4)
+%{
+/* ZVAL_STRING segfault when s is null */
+#undef ZVAL_STRING
+#define ZVAL_STRING(z, s, duplicate) { \
+ char *__s=(s); \
+ if (__s) { \
+ (z)->value.str.len = strlen(__s); \
+ (z)->value.str.val = (duplicate?estrndup(__s, (z)->value.str.len):__s); \
+ } else { \
+ (z)->value.str.len = 0; \
+ (z)->value.str.val = empty_string; \
+ } \
+ (z)->type = IS_STRING; \
+ }
+%}
+#endif
+
+
#define gint int
#define guint unsigned int
#define gchar char