Skip to content

Commit c6862d0

Browse files
committed
Inline DBA_GET2 macro
It was used only twice
1 parent 29ef652 commit c6862d0

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

ext/dba/dba.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ ZEND_TSRMLS_CACHE_DEFINE()
8989
ZEND_GET_MODULE(dba)
9090
#endif
9191

92-
/* these are used to get the standard arguments */
93-
9492
/* {{{ php_dba_myke_key */
9593
static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
9694
{
@@ -134,17 +132,6 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
134132
}
135133
/* }}} */
136134

137-
#define DBA_GET2 \
138-
zval *key; \
139-
char *key_str, *key_free; \
140-
size_t key_len; \
141-
if (zend_parse_parameters(ac, "zr", &key, &id) == FAILURE) { \
142-
RETURN_THROWS(); \
143-
} \
144-
if ((key_len = php_dba_make_key(key, &key_str, &key_free)) == 0) {\
145-
RETURN_FALSE; \
146-
}
147-
148135
#define DBA_FETCH_RESOURCE(info, id) \
149136
if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NULL) { \
150137
RETURN_THROWS(); \
@@ -910,7 +897,16 @@ PHP_FUNCTION(dba_exists)
910897
zval *id;
911898
dba_info *info = NULL;
912899
int ac = ZEND_NUM_ARGS();
913-
DBA_GET2;
900+
zval *key;
901+
char *key_str, *key_free;
902+
size_t key_len;
903+
904+
if (zend_parse_parameters(ac, "zr", &key, &id) == FAILURE) {
905+
RETURN_THROWS();
906+
}
907+
if ((key_len = php_dba_make_key(key, &key_str, &key_free)) == 0) {
908+
RETURN_FALSE;
909+
}
914910
DBA_FETCH_RESOURCE_WITH_ID(info, id);
915911

916912
if(info->hnd->exists(info, key_str, key_len) == SUCCESS) {
@@ -1078,7 +1074,16 @@ PHP_FUNCTION(dba_delete)
10781074
zval *id;
10791075
dba_info *info = NULL;
10801076
int ac = ZEND_NUM_ARGS();
1081-
DBA_GET2;
1077+
zval *key;
1078+
char *key_str, *key_free;
1079+
size_t key_len;
1080+
1081+
if (zend_parse_parameters(ac, "zr", &key, &id) == FAILURE) {
1082+
RETURN_THROWS();
1083+
}
1084+
if ((key_len = php_dba_make_key(key, &key_str, &key_free)) == 0) {
1085+
RETURN_FALSE;
1086+
}
10821087
DBA_FETCH_RESOURCE_WITH_ID(info, id);
10831088

10841089
DBA_WRITE_CHECK_WITH_ID;

0 commit comments

Comments
 (0)