Skip to content

Commit 84e17d8

Browse files
committed
Inline DBA_GET2_3 macro
It is only used once
1 parent b8327cf commit 84e17d8

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

ext/dba/dba.c

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -152,30 +152,6 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
152152
RETURN_FALSE; \
153153
}
154154

155-
#define DBA_GET2_3 \
156-
zval *key; \
157-
char *key_str, *key_free; \
158-
size_t key_len; \
159-
zend_long skip = 0; \
160-
switch(ac) { \
161-
case 2: \
162-
if (zend_parse_parameters(ac, "zr", &key, &id) == FAILURE) { \
163-
RETURN_THROWS(); \
164-
} \
165-
break; \
166-
case 3: \
167-
if (zend_parse_parameters(ac, "zlr", &key, &skip, &id) == FAILURE) { \
168-
RETURN_THROWS(); \
169-
} \
170-
break; \
171-
default: \
172-
WRONG_PARAM_COUNT; \
173-
} \
174-
if ((key_len = php_dba_make_key(key, &key_str, &key_free)) == 0) {\
175-
RETURN_FALSE; \
176-
}
177-
178-
179155
#define DBA_FETCH_RESOURCE(info, id) \
180156
if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NULL) { \
181157
RETURN_THROWS(); \
@@ -957,7 +933,29 @@ PHP_FUNCTION(dba_fetch)
957933
char *val;
958934
size_t len = 0;
959935
DBA_ID_PARS;
960-
DBA_GET2_3;
936+
zval *key;
937+
char *key_str, *key_free;
938+
size_t key_len;
939+
zend_long skip = 0;
940+
941+
switch(ac) {
942+
case 2:
943+
if (zend_parse_parameters(ac, "zr", &key, &id) == FAILURE) {
944+
RETURN_THROWS();
945+
}
946+
break;
947+
case 3:
948+
if (zend_parse_parameters(ac, "zlr", &key, &skip, &id) == FAILURE) {
949+
RETURN_THROWS();
950+
}
951+
break;
952+
default:
953+
WRONG_PARAM_COUNT;
954+
}
955+
if ((key_len = php_dba_make_key(key, &key_str, &key_free)) == 0) {
956+
RETURN_FALSE;
957+
}
958+
961959
DBA_FETCH_RESOURCE_WITH_ID(info, id);
962960

963961
if (ac==3) {

0 commit comments

Comments
 (0)