svn commit: r295237 - user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools
Garrett Cooper
ngie at FreeBSD.org
Thu Feb 4 08:15:19 UTC 2016
Author: ngie
Date: Thu Feb 4 08:15:17 2016
New Revision: 295237
URL: https://svnweb.freebsd.org/changeset/base/295237
Log:
Convert `enum tok tok` to `int32_t tok` in many places to account
for the fact that sometimes characters not in enum tok ['(', ')', etc]
are tested for in switch statements, and that the function get_token
actually returns int32_t, not enum tok, thus limiting the return type
incorrectly
Reported by: clang 3.7.2, gcc 4.9.4
Modified:
user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
Modified: user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c
==============================================================================
--- user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c Thu Feb 4 08:11:44 2016 (r295236)
+++ user/ngie/bsnmp_cleanup/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpimport.c Thu Feb 4 08:15:17 2016 (r295237)
@@ -513,7 +513,7 @@ snmp_import_update_table(enum snmp_tbl_e
}
static int32_t
-parse_enum(struct snmp_toolinfo *snmptoolctx, enum tok *tok,
+parse_enum(struct snmp_toolinfo *snmptoolctx, int32_t *tok,
struct enum_pairs *enums)
{
while ((*tok = gettoken(snmptoolctx)) == TOK_STR) {
@@ -532,7 +532,7 @@ parse_enum(struct snmp_toolinfo *snmptoo
}
static int32_t
-parse_subtype(struct snmp_toolinfo *snmptoolctx, enum tok *tok,
+parse_subtype(struct snmp_toolinfo *snmptoolctx, int32_t *tok,
enum snmp_tc *tc)
{
if ((*tok = gettoken(snmptoolctx)) != TOK_STR) {
@@ -547,7 +547,7 @@ parse_subtype(struct snmp_toolinfo *snmp
}
static int32_t
-parse_type(struct snmp_toolinfo *snmptoolctx, enum tok *tok,
+parse_type(struct snmp_toolinfo *snmptoolctx, int32_t *tok,
enum snmp_tc *tc, struct enum_pairs **snmp_enum)
{
int32_t syntax, mem;
@@ -630,10 +630,9 @@ snmp_import_head(struct snmp_toolinfo *s
static int32_t
snmp_import_table(struct snmp_toolinfo *snmptoolctx, struct snmp_oid2str *obj)
{
- int32_t i;
- enum snmp_tc tc;
- enum tok tok;
struct snmp_index_entry *entry;
+ enum snmp_tc tc;
+ int32_t i, tok;
if ((entry = malloc(sizeof(struct snmp_index_entry))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
@@ -704,7 +703,7 @@ snmp_import_table(struct snmp_toolinfo *
* Read everything after the syntax type that is certainly a leaf OID info.
*/
static int32_t
-snmp_import_leaf(struct snmp_toolinfo *snmptoolctx, enum tok *tok,
+snmp_import_leaf(struct snmp_toolinfo *snmptoolctx, int32_t *tok,
struct snmp_oid2str *oid2str)
{
int32_t i, syntax;
@@ -757,7 +756,7 @@ snmp_import_object(struct snmp_toolinfo
{
char *string;
int i;
- enum tok tok;
+ int32_t tok;
struct snmp_oid2str *oid2str;
if (snmp_import_head(snmptoolctx) < 0)
@@ -856,7 +855,7 @@ error:
}
static int32_t
-snmp_import_tree(struct snmp_toolinfo *snmptoolctx, enum tok *tok)
+snmp_import_tree(struct snmp_toolinfo *snmptoolctx, int32_t *tok)
{
while (*tok != TOK_EOF) {
switch (*tok) {
@@ -882,7 +881,7 @@ snmp_import_tree(struct snmp_toolinfo *s
}
static int32_t
-snmp_import_top(struct snmp_toolinfo *snmptoolctx, enum tok *tok)
+snmp_import_top(struct snmp_toolinfo *snmptoolctx, int32_t *tok)
{
enum snmp_tc tc;
struct enum_type *t;
@@ -939,7 +938,7 @@ static int32_t
snmp_import(struct snmp_toolinfo *snmptoolctx)
{
int i;
- enum tok tok;
+ int32_t tok;
tok = gettoken(snmptoolctx);
More information about the svn-src-user
mailing list