lytboris                                 Sun, 17 Jul 2011 18:17:43 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=313338

Log:
swap non_repeaters and max_repetitions in walk query, max_repetitions whould be 
used more frequently

Changed paths:
    _U  php/php-src/trunk/ext/snmp/
    U   php/php-src/trunk/ext/snmp/snmp.c
    U   php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt
    U   php/php-src/trunk/ext/snmp/tests/snmp-object.phpt


Property changes on: php/php-src/trunk/ext/snmp
___________________________________________________________________
Added: svn:mergeinfo
   + /php/php-src/branches/PHP_5_4/ext/snmp:313331,313336
/php/php-src/trunk/ext/snmp:284726

Modified: php/php-src/trunk/ext/snmp/snmp.c
===================================================================
--- php/php-src/trunk/ext/snmp/snmp.c   2011-07-17 18:15:37 UTC (rev 313337)
+++ php/php-src/trunk/ext/snmp/snmp.c   2011-07-17 18:17:43 UTC (rev 313338)
@@ -353,8 +353,8 @@
 ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_walk, 0, 0, 4)
        ZEND_ARG_INFO(0, object_id)
        ZEND_ARG_INFO(0, suffix_keys)
+       ZEND_ARG_INFO(0, max_repetitions)
        ZEND_ARG_INFO(0, non_repeaters)
-       ZEND_ARG_INFO(0, max_repetitions)
 ZEND_END_ARG_INFO()

 ZEND_BEGIN_ARG_INFO_EX(arginfo_snmp_set, 0, 0, 3)
@@ -1370,7 +1370,7 @@
                                RETURN_FALSE;
                        }
                } else if (st & SNMP_CMD_WALK) {
-                       if (zend_parse_parameters(argc TSRMLS_CC, "Z|bll", 
&oid, &suffix_keys, &(objid_query.non_repeaters), 
&(objid_query.max_repetitions)) == FAILURE) {
+                       if (zend_parse_parameters(argc TSRMLS_CC, "Z|bll", 
&oid, &suffix_keys, &(objid_query.max_repetitions), 
&(objid_query.non_repeaters)) == FAILURE) {
                                RETURN_FALSE;
                        }
                        if (suffix_keys) {
@@ -1792,7 +1792,7 @@
 }
 /* }}} */

-/* {{{ proto mixed SNMP::walk(mixed object_id [, bool $suffix_as_key = FALSE 
[, int $non_repeaters [, int $max_repetitions ]]])
+/* {{{ proto mixed SNMP::walk(mixed object_id [, bool $suffix_as_key = FALSE 
[, int $max_repetitions [, int $non_repeaters]])
    Return all objects including their respective object id withing the 
specified one as array of oid->value pairs */
 PHP_METHOD(snmp, walk)
 {

Modified: php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt
===================================================================
--- php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt     2011-07-17 
18:15:37 UTC (rev 313337)
+++ php/php-src/trunk/ext/snmp/tests/snmp-object-error.phpt     2011-07-17 
18:17:43 UTC (rev 313338)
@@ -47,7 +47,7 @@

 $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, 
$retries);
 var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, ''));
-var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, 0, ''));
+var_dump($session->walk('.1.3.6.1.2.1.1', FALSE, 30, ''));
 var_dump($session->get());
 var_dump($session->getnext());
 var_dump($session->set());

Modified: php/php-src/trunk/ext/snmp/tests/snmp-object.phpt
===================================================================
--- php/php-src/trunk/ext/snmp/tests/snmp-object.phpt   2011-07-17 18:15:37 UTC 
(rev 313337)
+++ php/php-src/trunk/ext/snmp/tests/snmp-object.phpt   2011-07-17 18:17:43 UTC 
(rev 313338)
@@ -48,18 +48,18 @@
 var_dump(array_shift($z));
 var_dump($session->close());

-echo "WALK multiple on single OID, non_repeaters set to 0\n";
+echo "WALK multiple on single OID, max_repetitions set to 30\n";
 $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, 
$retries);
-$z = $session->walk('.1.3.6.1.2.1.1', 0);
+$z = $session->walk('.1.3.6.1.2.1.1', FALSE, 30);
 var_dump(gettype($z));
 var_dump(count($z));
 var_dump(key($z));
 var_dump(array_shift($z));
 var_dump($session->close());

-echo "WALK multiple on single OID, non_repeaters set to 0, max_repetitions set 
to 30\n";
+echo "WALK multiple on single OID, max_repetitions set to 30, non_repeaters 
set to 0\n";
 $session = new SNMP(SNMP::VERSION_2c, $hostname, $community, $timeout, 
$retries);
-$z = $session->walk('.1.3.6.1.2.1.1', 0, 30);
+$z = $session->walk('.1.3.6.1.2.1.1', FALSE, 30, 0);
 var_dump(gettype($z));
 var_dump(count($z));
 var_dump(key($z));
@@ -154,13 +154,13 @@
 string(%d) "%S"
 string(%d) "%S"
 bool(true)
-WALK multiple on single OID, non_repeaters set to 0
+WALK multiple on single OID, max_repetitions set to 30
 string(5) "array"
 int(%d)
 string(%d) "%S"
 string(%d) "%S"
 bool(true)
-WALK multiple on single OID, non_repeaters set to 0, max_repetitions set to 30
+WALK multiple on single OID, max_repetitions set to 30, non_repeaters set to 0
 string(5) "array"
 int(%d)
 string(%d) "%S"

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to