Skip to content

Commit 6bd66f7

Browse files
Girgiasnikic
authored andcommitted
Remove useless param in php_snmp_error()
It is always NULL.
1 parent 32e6d08 commit 6bd66f7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

ext/snmp/snmp.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ static zend_object *php_snmp_object_new(zend_class_entry *class_type) /* {{{ */
486486
* Record last SNMP-related error in object
487487
*
488488
*/
489-
static void php_snmp_error(zval *object, const char *docref, int type, const char *format, ...)
489+
static void php_snmp_error(zval *object, int type, const char *format, ...)
490490
{
491491
va_list args;
492492
php_snmp_object *snmp_object = NULL;
@@ -511,7 +511,7 @@ static void php_snmp_error(zval *object, const char *docref, int type, const cha
511511
zend_throw_exception_ex(php_snmp_exception_ce, type, "%s", snmp_object->snmp_errstr);
512512
} else {
513513
va_start(args, format);
514-
php_verror(docref, "", E_WARNING, format, args);
514+
php_verror(NULL, "", E_WARNING, format, args);
515515
va_end(args);
516516
}
517517
}
@@ -685,7 +685,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
685685
RETVAL_FALSE;
686686

687687
/* reset errno and errstr */
688-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_NOERROR, "");
688+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_NOERROR, "");
689689

690690
if (st & SNMP_CMD_WALK) { /* remember root OID */
691691
memmove((char *)root, (char *)(objid_query->vars[0].name), (objid_query->vars[0].name_length) * sizeof(oid));
@@ -702,7 +702,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
702702
}
703703

704704
if ((st & SNMP_CMD_SET) && objid_query->count > objid_query->step) {
705-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES, "Can not fit all OIDs for SET query into one packet, using multiple queries");
705+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES, "Can not fit all OIDs for SET query into one packet, using multiple queries");
706706
}
707707

708708
while (keepwalking) {
@@ -733,7 +733,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
733733
if (st & SNMP_CMD_SET) {
734734
if ((snmp_errno = snmp_add_var(pdu, objid_query->vars[objid_query->offset].name, objid_query->vars[objid_query->offset].name_length, objid_query->vars[objid_query->offset].type, objid_query->vars[objid_query->offset].value))) {
735735
snprint_objid(buf, sizeof(buf), objid_query->vars[objid_query->offset].name, objid_query->vars[objid_query->offset].name_length);
736-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Could not add variable: OID='%s' type='%c' value='%s': %s", buf, objid_query->vars[objid_query->offset].type, objid_query->vars[objid_query->offset].value, snmp_api_errstring(snmp_errno));
736+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Could not add variable: OID='%s' type='%c' value='%s': %s", buf, objid_query->vars[objid_query->offset].type, objid_query->vars[objid_query->offset].value, snmp_api_errstring(snmp_errno));
737737
snmp_free_pdu(pdu);
738738
snmp_close(ss);
739739
RETVAL_FALSE;
@@ -775,7 +775,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
775775
}
776776
snprint_objid(buf, sizeof(buf), vars->name, vars->name_length);
777777
snprint_value(buf2, sizeof(buf2), vars->name, vars->name_length, vars);
778-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_ERROR_IN_REPLY, "Error in packet at '%s': %s", buf, buf2);
778+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_ERROR_IN_REPLY, "Error in packet at '%s': %s", buf, buf2);
779779
continue;
780780
}
781781

@@ -843,7 +843,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
843843
if (st & SNMP_CMD_WALK) {
844844
if (objid_query->oid_increasing_check == TRUE && snmp_oid_compare(objid_query->vars[0].name, objid_query->vars[0].name_length, vars->name, vars->name_length) >= 0) {
845845
snprint_objid(buf2, sizeof(buf2), vars->name, vars->name_length);
846-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_OID_NOT_INCREASING, "Error: OID not increasing: %s", buf2);
846+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_OID_NOT_INCREASING, "Error: OID not increasing: %s", buf2);
847847
keepwalking = 0;
848848
} else {
849849
memmove((char *)(objid_query->vars[0].name), (char *)vars->name, vars->name_length * sizeof(oid));
@@ -876,9 +876,9 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
876876
}
877877
if (vars) {
878878
snprint_objid(buf, sizeof(buf), vars->name, vars->name_length);
879-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_ERROR_IN_REPLY, "Error in packet at '%s': %s", buf, snmp_errstring(response->errstat));
879+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_ERROR_IN_REPLY, "Error in packet at '%s': %s", buf, snmp_errstring(response->errstat));
880880
} else {
881-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_ERROR_IN_REPLY, "Error in packet at %u object_id: %s", response->errindex, snmp_errstring(response->errstat));
881+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_ERROR_IN_REPLY, "Error in packet at %u object_id: %s", response->errindex, snmp_errstring(response->errstat));
882882
}
883883
if (st & (SNMP_CMD_GET | SNMP_CMD_GETNEXT)) { /* cut out bogus OID and retry */
884884
if ((pdu = snmp_fix_pdu(response, ((st & SNMP_CMD_GET) ? SNMP_MSG_GET : SNMP_MSG_GETNEXT) )) != NULL) {
@@ -896,7 +896,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
896896
}
897897
}
898898
} else if (status == STAT_TIMEOUT) {
899-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_TIMEOUT, "No response from %s", session->peername);
899+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_TIMEOUT, "No response from %s", session->peername);
900900
if (objid_query->array_output) {
901901
zval_ptr_dtor(return_value);
902902
}
@@ -905,7 +905,7 @@ static void php_snmp_internal(INTERNAL_FUNCTION_PARAMETERS, int st,
905905
return;
906906
} else { /* status == STAT_ERROR */
907907
snmp_error(ss, NULL, NULL, &err);
908-
php_snmp_error(getThis(), NULL, PHP_SNMP_ERRNO_GENERIC, "Fatal error: %s", err);
908+
php_snmp_error(getThis(), PHP_SNMP_ERRNO_GENERIC, "Fatal error: %s", err);
909909
free(err);
910910
if (objid_query->array_output) {
911911
zval_ptr_dtor(return_value);
@@ -1036,14 +1036,14 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu
10361036
/* now parse all OIDs */
10371037
if (st & SNMP_CMD_WALK) {
10381038
if (objid_query->count > 1) {
1039-
php_snmp_error(object, NULL, PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Multi OID walks are not supported!");
1039+
php_snmp_error(object, PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Multi OID walks are not supported!");
10401040
efree(objid_query->vars);
10411041
return FALSE;
10421042
}
10431043
objid_query->vars[0].name_length = MAX_NAME_LEN;
10441044
if (strlen(objid_query->vars[0].oid)) { /* on a walk, an empty string means top of tree - no error */
10451045
if (!snmp_parse_oid(objid_query->vars[0].oid, objid_query->vars[0].name, &(objid_query->vars[0].name_length))) {
1046-
php_snmp_error(object, NULL, PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Invalid object identifier: %s", objid_query->vars[0].oid);
1046+
php_snmp_error(object, PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Invalid object identifier: %s", objid_query->vars[0].oid);
10471047
efree(objid_query->vars);
10481048
return FALSE;
10491049
}
@@ -1055,7 +1055,7 @@ static int php_snmp_parse_oid(zval *object, int st, struct objid_query *objid_qu
10551055
for (objid_query->offset = 0; objid_query->offset < objid_query->count; objid_query->offset++) {
10561056
objid_query->vars[objid_query->offset].name_length = MAX_OID_LEN;
10571057
if (!snmp_parse_oid(objid_query->vars[objid_query->offset].oid, objid_query->vars[objid_query->offset].name, &(objid_query->vars[objid_query->offset].name_length))) {
1058-
php_snmp_error(object, NULL, PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Invalid object identifier: %s", objid_query->vars[objid_query->offset].oid);
1058+
php_snmp_error(object, PHP_SNMP_ERRNO_OID_PARSING_ERROR, "Invalid object identifier: %s", objid_query->vars[objid_query->offset].oid);
10591059
efree(objid_query->vars);
10601060
return FALSE;
10611061
}

0 commit comments

Comments
 (0)