Skip to content

Commit a8c2172

Browse files
committed
chore(agent): remove obsolete code (8/17) (#1077)
This PR removes obsolete `PHP7` codeblocks. PR: 8/17
1 parent f1a42a0 commit a8c2172

File tree

1 file changed

+0
-99
lines changed

1 file changed

+0
-99
lines changed

agent/php_hash.c

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "php_agent.h"
66
#include "php_hash.h"
77

8-
#ifdef PHP7
98
static int nr_php_zend_hash_ptr_apply_wrapper(zval* value,
109
int num_args,
1110
va_list args,
@@ -24,26 +23,6 @@ static int nr_php_zend_hash_ptr_apply_wrapper(zval* value,
2423

2524
return (apply_func)(Z_PTR_P(value), arg, hash_key TSRMLS_CC);
2625
}
27-
#else
28-
static int nr_php_zend_hash_ptr_apply_wrapper(void* value TSRMLS_DC,
29-
int num_args,
30-
va_list args,
31-
zend_hash_key* hash_key) {
32-
nr_php_ptr_apply_t apply_func;
33-
void* arg;
34-
35-
(void)num_args;
36-
37-
apply_func = (nr_php_ptr_apply_t)va_arg(args, nr_php_ptr_apply_t);
38-
arg = (void*)va_arg(args, void*);
39-
40-
if (NULL == value) {
41-
return ZEND_HASH_APPLY_KEEP;
42-
}
43-
44-
return (apply_func)(value, arg, hash_key TSRMLS_CC);
45-
}
46-
#endif /* PHP7 */
4726

4827
void nr_php_zend_hash_ptr_apply(HashTable* ht,
4928
nr_php_ptr_apply_t apply_func,
@@ -53,7 +32,6 @@ void nr_php_zend_hash_ptr_apply(HashTable* ht,
5332
apply_func, arg);
5433
}
5534

56-
#ifdef PHP7
5735
static int nr_php_zend_hash_zval_apply_wrapper(zval* value,
5836
int num_args,
5937
va_list args,
@@ -68,28 +46,6 @@ static int nr_php_zend_hash_zval_apply_wrapper(zval* value,
6846

6947
return (apply_func)(value, arg, hash_key TSRMLS_CC);
7048
}
71-
#else
72-
static int nr_php_zend_hash_zval_apply_wrapper(zval** value TSRMLS_DC,
73-
int num_args,
74-
va_list args,
75-
zend_hash_key* hash_key) {
76-
nr_php_zval_apply_t apply_func;
77-
void* arg;
78-
79-
(void)num_args;
80-
81-
apply_func = (nr_php_zval_apply_t)va_arg(args, nr_php_zval_apply_t);
82-
arg = (void*)va_arg(args, void*);
83-
84-
if ((NULL == value) || (NULL == *value)) {
85-
return ZEND_HASH_APPLY_KEEP;
86-
}
87-
88-
(void)num_args;
89-
90-
return (apply_func)(*value, arg, hash_key TSRMLS_CC);
91-
}
92-
#endif /* PHP7 */
9349

9450
void nr_php_zend_hash_zval_apply(HashTable* ht,
9551
nr_php_zval_apply_t apply_func,
@@ -104,17 +60,13 @@ int nr_php_zend_hash_del(HashTable* ht, const char* key) {
10460
return 0;
10561
}
10662

107-
#ifdef PHP7
10863
int retval;
10964
zend_string* zs = zend_string_init(key, nr_strlen(key), 0);
11065

11166
retval = zend_hash_del(ht, zs);
11267
zend_string_free(zs);
11368

11469
return (SUCCESS == retval);
115-
#else
116-
return (SUCCESS == zend_hash_del(ht, key, nr_strlen(key) + 1));
117-
#endif /* PHP7 */
11870
}
11971

12072
int nr_php_zend_hash_exists(const HashTable* ht, const char* key) {
@@ -124,14 +76,9 @@ int nr_php_zend_hash_exists(const HashTable* ht, const char* key) {
12476
* lookups!
12577
*/
12678

127-
#ifdef PHP7
12879
return zend_hash_str_exists(ht, key, nr_strlen(key));
129-
#else
130-
return zend_hash_exists(ht, key, nr_strlen(key) + 1);
131-
#endif /* PHP7 */
13280
}
13381

134-
#ifdef PHP7
13582
zval* nr_php_zend_hash_find(const HashTable* ht, const char* key) {
13683
if ((NULL == ht) || (NULL == key) || ('\0' == key[0])) {
13784
return NULL;
@@ -155,49 +102,3 @@ zval* nr_php_zend_hash_index_find(const HashTable* ht, zend_ulong index) {
155102

156103
return zend_hash_index_find(ht, index);
157104
}
158-
#else /* Not PHP7 */
159-
void* nr_php_zend_hash_find_ptr(const HashTable* ht, const char* key) {
160-
void* data = NULL;
161-
int keylen;
162-
int rv;
163-
164-
if ((0 == ht) || (0 == key)) {
165-
return NULL;
166-
}
167-
168-
keylen = nr_strlen(key);
169-
if (keylen <= 0) {
170-
return NULL;
171-
}
172-
keylen += 1; /* Lookup length requires null terminator */
173-
174-
rv = zend_hash_find(ht, key, keylen, &data);
175-
if (SUCCESS != rv) {
176-
return NULL;
177-
}
178-
179-
return data;
180-
}
181-
182-
zval* nr_php_zend_hash_find(const HashTable* ht, const char* key) {
183-
zval** zv_pp = (zval**)nr_php_zend_hash_find_ptr(ht, key);
184-
185-
if (NULL == zv_pp) {
186-
return NULL;
187-
}
188-
189-
return *zv_pp;
190-
}
191-
192-
zval* nr_php_zend_hash_index_find(const HashTable* ht, zend_ulong index) {
193-
void* data = NULL;
194-
int rv;
195-
196-
rv = zend_hash_index_find(ht, index, &data);
197-
if ((SUCCESS != rv) || (NULL == data)) {
198-
return NULL;
199-
}
200-
201-
return *((zval**)data);
202-
}
203-
#endif /* PHP7 */

0 commit comments

Comments
 (0)