Skip to content

Commit

Permalink
smart_str/smart_string changes
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Aug 29, 2015
1 parent 89ad584 commit 4dfd42a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
18 changes: 7 additions & 11 deletions xdebug_stack.c
Expand Up @@ -26,11 +26,7 @@
#include "xdebug_superglobals.h"
#include "xdebug_var.h"
#include "ext/standard/html.h"
#if PHP_VERSION_ID >= 70000
# include "Zend/zend_smart_str.h"
#else
# include "ext/standard/php_smart_str.h"
#endif
#include "ext/standard/php_smart_string.h"

#include "main/php_ini.h"

Expand Down Expand Up @@ -259,26 +255,26 @@ void xdebug_append_error_description(xdebug_str *str, int html, const char *erro
* it to a tmp string, and then adds an HTML escaped string for the
* rest of the original buffer. */
if (first_closing && strstr(buffer, "() [<a href=") != NULL) {
smart_str special_escaped = {0};
smart_string special_escaped = {0};

*first_closing = '\0';
first_closing++;
smart_str_appends(&special_escaped, buffer);
smart_string_appends(&special_escaped, buffer);

#if PHP_VERSION_ID >= 70000
tmp = php_escape_html_entities((unsigned char *) first_closing, strlen(first_closing), 0, 0, NULL TSRMLS_CC);
smart_str_appends(&special_escaped, tmp->val);
smart_string_appends(&special_escaped, tmp->val);
zend_string_free(tmp);
#else
tmp = php_escape_html_entities((unsigned char *) first_closing, strlen(first_closing), &newlen, 0, 0, NULL TSRMLS_CC);
smart_str_appends(&special_escaped, tmp);
STR_FREE(tmp);
#endif

smart_str_0(&special_escaped);
smart_string_0(&special_escaped);

escaped = estrdup(special_escaped.s->val);
smart_str_free(&special_escaped);
escaped = estrdup(special_escaped.c);
smart_string_free(&special_escaped);
} else {
#if PHP_VERSION_ID >= 70000
tmp = php_escape_html_entities((unsigned char *) buffer, strlen(buffer), 0, 0, NULL TSRMLS_CC);
Expand Down
15 changes: 10 additions & 5 deletions xdebug_var.c
Expand Up @@ -19,11 +19,7 @@
#include "php.h"
#include "ext/standard/php_string.h"
#include "ext/standard/url.h"
#if PHP_VERSION_ID >= 70000
# include "Zend/zend_smart_str.h"
#else
# include "ext/standard/php_smart_str.h"
#endif
#include "ext/standard/php_smart_string.h"
#include "zend.h"
#include "zend_extensions.h"

Expand All @@ -34,6 +30,15 @@
#include "xdebug_var.h"
#include "xdebug_xml.h"

#if PHP_VERSION_ID >= 70000
# define STR_NAME_VAL(k) (k)->val
# define STR_NAME_LEN(k) (k)->len
#else
# define STR_NAME_VAL(k) (k)
# define STR_NAME_LEN(k) (k_length)
#endif


ZEND_EXTERN_MODULE_GLOBALS(xdebug)

HashTable *xdebug_objdebug_pp(zval **zval_pp, int *is_tmp TSRMLS_DC)
Expand Down

0 comments on commit 4dfd42a

Please sign in to comment.