diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-15 11:38:40 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-09-15 11:41:09 +0200 |
commit | da0663a337b608a4b0008672b494e3a71e6e4cfc (patch) | |
tree | f7f762ebfd671402a24182d4d95098b5d5154bf4 /ext/json/json_encoder.c | |
parent | 1bffe6b05cc790db5db3c8a44478ff2339f44ef3 (diff) | |
download | php-git-da0663a337b608a4b0008672b494e3a71e6e4cfc.tar.gz |
Add GC_TRY_ADDREF macro
That adds a ref if not immutable. Also audit uses of GC_IMMUTABLE
to either use GC_TRY_ADDREF or GC_TRY_PROTECT_RECURSION.
Diffstat (limited to 'ext/json/json_encoder.c')
-rw-r--r-- | ext/json/json_encoder.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/json/json_encoder.c b/ext/json/json_encoder.c index d08a466643..92e4a10933 100644 --- a/ext/json/json_encoder.c +++ b/ext/json/json_encoder.c @@ -113,15 +113,15 @@ static inline void php_json_encode_double(smart_str *buf, double d, int options) #define PHP_JSON_HASH_PROTECT_RECURSION(_tmp_ht) \ do { \ - if (_tmp_ht && !(GC_FLAGS(_tmp_ht) & GC_IMMUTABLE)) { \ - GC_PROTECT_RECURSION(_tmp_ht); \ + if (_tmp_ht) { \ + GC_TRY_PROTECT_RECURSION(_tmp_ht); \ } \ } while (0) #define PHP_JSON_HASH_UNPROTECT_RECURSION(_tmp_ht) \ do { \ - if (_tmp_ht && !(GC_FLAGS(_tmp_ht) & GC_IMMUTABLE)) { \ - GC_UNPROTECT_RECURSION(_tmp_ht); \ + if (_tmp_ht) { \ + GC_TRY_UNPROTECT_RECURSION(_tmp_ht); \ } \ } while (0) |