Use a better idiom for finding UTC prefixed timezones
Instead of copy-pasting the string literal for "UTC" 3 times and using strlen, use a static char[3] buffer and sizeof(..). MFC after: 3 days X-MFC with: r298507 Submitted by: kib Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
3db4f9fcfe
commit
51f1c1e1eb
@ -338,8 +338,9 @@ static char *
|
||||
snmp_date2asn_oid(char *str, struct asn_oid *oid)
|
||||
{
|
||||
char *endptr, *ptr;
|
||||
uint32_t v;
|
||||
static const char UTC[3] = "UTC";
|
||||
int32_t saved_errno;
|
||||
uint32_t v;
|
||||
|
||||
if (snmp_suboid_append(oid, (asn_subid_t) SNMP_DATETIME_OCTETS) < 0)
|
||||
return (NULL);
|
||||
@ -440,8 +441,8 @@ snmp_date2asn_oid(char *str, struct asn_oid *oid)
|
||||
|
||||
/* 'UTC' - optional */
|
||||
ptr = endptr + 1;
|
||||
if (strncmp(ptr, "UTC", strlen("UTC")) == 0)
|
||||
ptr += strlen("UTC");
|
||||
if (strncmp(ptr, UTC, sizeof(UTC)) == 0)
|
||||
ptr += sizeof(UTC);
|
||||
|
||||
/* '+/-' */
|
||||
if (*ptr == '-' || *ptr == '+') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user