ZVAL_STRING macro for PHP
This commit is contained in:
parent
78e9a2b30f
commit
ed0ad92133
20
swig/Lasso.i
20
swig/Lasso.i
|
@ -94,6 +94,7 @@
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifdef SWIGPYTHON
|
#ifdef SWIGPYTHON
|
||||||
%{
|
%{
|
||||||
PyObject *lassoError;
|
PyObject *lassoError;
|
||||||
|
@ -141,6 +142,25 @@ SyntaxError = _lasso.SyntaxError
|
||||||
#endif
|
#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 gint int
|
||||||
#define guint unsigned int
|
#define guint unsigned int
|
||||||
#define gchar char
|
#define gchar char
|
||||||
|
|
Loading…
Reference in New Issue