diff options
author | Stig Bakken <ssb@php.net> | 1999-07-21 14:43:12 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 1999-07-21 14:43:12 +0000 |
commit | 57f0f15b9f2c903ff0aaaaa12917b47ee9308de0 (patch) | |
tree | d694b88de5860a66122b969ab41723c5e28e8673 /ext/xml/xml.c | |
parent | 968d6d9f8d636e14dda035da94da5d56675aa61c (diff) | |
download | php-git-57f0f15b9f2c903ff0aaaaa12917b47ee9308de0.tar.gz |
Debian fixes
Diffstat (limited to 'ext/xml/xml.c')
-rw-r--r-- | ext/xml/xml.c | 69 |
1 files changed, 50 insertions, 19 deletions
diff --git a/ext/xml/xml.c b/ext/xml/xml.c index acfe5ccb05..66ea4a043d 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -92,27 +92,44 @@ DLEXPORT php3_module_entry *get_module() { return &xml_module_entry; }; #if PHP_API_VERSION >= 19990421 #define php3tls_pval_destructor(a) zval_dtor(a) #endif -static pval *php3i_long_pval(long value) + /* {{{ php3i_long_pval() */ + +PHPAPI pval *php3i_long_pval(long value) +{ + pval *ret = emalloc(sizeof(pval)); + + ret->type = IS_LONG; + ret->value.lval = value; + return ret; +} + +/* }}} */ + /* {{{ php3i_double_pval() */ + +PHPAPI pval *php3i_double_pval(double value) { - pval *ret = emalloc(sizeof(pval)); - - ret->type = IS_LONG; - ret->value.lval = value; - INIT_PZVAL(ret); - return ret; + pval *ret = emalloc(sizeof(pval)); + + ret->type = IS_DOUBLE; + ret->value.dval = value; + return ret; } -static pval *php3i_string_pval(const char *str) +/* }}} */ + /* {{{ php3i_string_pval() */ + +PHPAPI pval *php3i_string_pval(const char *str) { - pval *ret = emalloc(sizeof(pval)); - int len = strlen(str); - - ret->type = IS_STRING; - ret->value.str.len = len; - INIT_PZVAL(ret); - ret->value.str.val = estrndup(str, len); - return ret; -} + pval *ret = emalloc(sizeof(pval)); + int len = strlen(str); + + ret->type = IS_STRING; + ret->value.str.len = len; + ret->value.str.val = estrndup(str, len); + return ret; +} + +/* }}} */ /* end of UGLY HACK!!! */ @@ -618,7 +635,21 @@ static int php3i_xmlcharlen(const XML_Char *s) } /* }}} */ -/* {{{ php3i_add_to_info */ + /* {{{ php3i_pval_strdup() */ + +PHPAPI char *php3i_pval_strdup(pval *val) +{ + if (val->type == IS_STRING) { + char *buf = emalloc(val->value.str.len + 1); + memcpy(buf, val->value.str.val, val->value.str.len); + buf[val->value.str.len] = '\0'; + return buf; + } + return NULL; +} + +/* }}} */ + /* {{{ php3i_add_to_info */ static void php3i_add_to_info(xml_parser *parser,char *name) { pval **element, *values; @@ -645,7 +676,7 @@ static void php3i_add_to_info(xml_parser *parser,char *name) } /* }}} */ -/* {{{ php3i_xml_startElementHandler() */ + /* {{{ php3i_xml_startElementHandler() */ void php3i_xml_startElementHandler(void *userData, const char *name, const char **attributes) |