ZVAL_STRING macro for PHP

This commit is contained in:
Christophe Nowicki 2004-09-07 15:09:00 +00:00
parent 78e9a2b30f
commit ed0ad92133
1 changed files with 20 additions and 0 deletions

View File

@ -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