Skip to content

Commit 17dc181

Browse files
committed
- Removed redundant local variable in dns_get_record.
- (5.3) Fixed bug in the Windows implementation of dns_get_record, where the two last parameters wouldn't be filled unless the type were DNS_ANY (Gustavo).
1 parent 91f6470 commit 17dc181

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

ext/standard/dns.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,6 @@ PHP_FUNCTION(dns_get_record)
707707
int hostname_len;
708708
long type_param = PHP_DNS_ANY;
709709
zval *authns = NULL, *addtl = NULL;
710-
int addtl_recs = 0;
711710
int type_to_fetch;
712711
#if defined(HAVE_DNS_SEARCH)
713712
struct sockaddr_storage from;
@@ -736,7 +735,6 @@ PHP_FUNCTION(dns_get_record)
736735
if (addtl) {
737736
zval_dtor(addtl);
738737
array_init(addtl);
739-
addtl_recs = 1;
740738
}
741739

742740
if (!raw) {
@@ -773,7 +771,7 @@ PHP_FUNCTION(dns_get_record)
773771
}
774772

775773
for ( ;
776-
type < (addtl_recs ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query;
774+
type < (addtl ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query;
777775
type++
778776
) {
779777
first_query = 0;
@@ -894,7 +892,7 @@ PHP_FUNCTION(dns_get_record)
894892
}
895893
}
896894

897-
if (addtl_recs && addtl) {
895+
if (addtl) {
898896
/* Additional records associated with authoritative name servers */
899897
while (ar-- > 0 && cp && cp < end) {
900898
zval *retval = NULL;

ext/standard/dns_win32.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ PHP_FUNCTION(dns_get_record)
347347
long type_param = PHP_DNS_ANY;
348348
zval *authns = NULL, *addtl = NULL;
349349
int type, type_to_fetch, first_query = 1, store_results = 1;
350-
int addtl_recs = 0;
351350
zend_bool raw = 0;
352351

353352
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz!z!b",
@@ -362,7 +361,6 @@ PHP_FUNCTION(dns_get_record)
362361
if (addtl) {
363362
zval_dtor(addtl);
364363
array_init(addtl);
365-
addtl_recs = 1;
366364
}
367365

368366
if (!raw) {
@@ -390,7 +388,7 @@ PHP_FUNCTION(dns_get_record)
390388
}
391389

392390
for ( ;
393-
type < (addtl_recs ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query;
391+
type < (addtl ? (PHP_DNS_NUM_TYPES + 2) : PHP_DNS_NUM_TYPES) || first_query;
394392
type++
395393
) {
396394
DNS_STATUS status; /* Return value of DnsQuery_A() function */

0 commit comments

Comments
 (0)