Re: cvs: php4 /ext/snmp snmp.c
| From: | Rasmus Lerdorf | Date: | Sat, 11 May 2002 17:04:53 +0000 |
| Subject: | Re: cvs: php4 /ext/snmp snmp.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-11836@lists.php.net to get a copy of this message | ||
Hey Sterling, if you are going to be maintaining this extension from now
on, great, but otherwise, I see no point in minor style changes like this.
if(gotroot==0) vs. if(!gotroot) ? Or a space here and there? That's not
worth the added diff baggage that gets in the way when someone tries to
track down real changes.
-Rasmus
On Sat, 11 May 2002, Sterling Hughes wrote:
> sterling Sat May 11 13:00:51 2002 EDT
>
> Modified files:
> /php4/ext/snmp snmp.c
> Log:
> WS Fixes (and similair stylistic changes)
>
>
> Index: php4/ext/snmp/snmp.c
> diff -u php4/ext/snmp/snmp.c:1.56 php4/ext/snmp/snmp.c:1.57
> --- php4/ext/snmp/snmp.c:1.56 Thu Feb 28 22:31:01 2002
> +++ php4/ext/snmp/snmp.c Sat May 11 13:00:49 2002
> @@ -17,7 +17,7 @@
> | Steven Lawrance <slawrance@technologist.com> |
> +----------------------------------------------------------------------+
> */
> -/* $Id: snmp.c,v 1.56 2002/03/01 03:31:01 yohgaki Exp $ */
> +/* $Id: snmp.c,v 1.57 2002/05/11 17:00:49 sterling Exp $ */
>
> #ifdef HAVE_CONFIG_H
> #include "config.h"
> @@ -148,7 +148,8 @@
> * st=11 snmpset() - query an agent and set a single value
> *
> */
> -void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
> +static void php_snmp(INTERNAL_FUNCTION_PARAMETERS, int st)
> +{
> zval **a1, **a2, **a3, **a4, **a5, **a6, **a7;
> struct snmp_session session, *ss;
> struct snmp_pdu *pdu=NULL, *response;
> @@ -215,15 +216,16 @@
>
> if (st >= 2) { /* walk */
> rootlen = MAX_NAME_LEN;
> - if ( strlen(objid) ) { /* on a walk, an empty string means top of tree - no error */
> - if ( read_objid(objid, root, &rootlen) ) {
> + if (strlen(objid)) { /* on a walk, an empty string means top of tree - no error */
> + if (read_objid(objid, root, &rootlen)) {
> gotroot = 1;
> } else {
> php_error(E_WARNING,"Invalid object identifier: %s\n", objid);
> }
> }
> - if (gotroot == 0) {
> - memmove((char *)root, (char *)objid_mib, sizeof(objid_mib));
> +
> + if (!gotroot) {
> + memmove((char *) root, (char *) objid_mib, sizeof(objid_mib));
> rootlen = sizeof(objid_mib) / sizeof(oid);
> gotroot = 1;
> }
> @@ -281,12 +283,12 @@
> }
> }
>
> - while(keepwalking) {
> - keepwalking=0;
> + while (keepwalking) {
> + keepwalking = 0;
> if (st == 1) {
> pdu = snmp_pdu_create(SNMP_MSG_GET);
> name_length = MAX_NAME_LEN;
> - if ( !read_objid(objid, name, &name_length) ) {
> + if (!read_objid(objid, name, &name_length)1) {
> php_error(E_WARNING,"Invalid object identifier: %s\n", objid);
> snmp_close(ss);
> RETURN_FALSE;
> @@ -317,9 +319,7 @@
> if (st != 11) {
> sprint_value((struct sbuf *)buf,vars->name, vars->name_length, vars);
> }
> -#if 0
> - Debug("snmp response is: %s\n",buf);
> -#endif
> +
> if (st == 1) {
> RETVAL_STRING(buf,1);
> } else if (st == 2) {
>
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>