netsnmp_ds_get_boolean:
  242|  2.38k|{
  243|  2.38k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  4.76k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (243:9): [True: 0, False: 2.38k]
  |  Branch (243:24): [True: 0, False: 2.38k]
  ------------------
  244|  2.38k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|  2.38k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (244:2): [True: 0, False: 2.38k]
  |  Branch (244:17): [True: 0, False: 2.38k]
  ------------------
  245|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  246|      0|    }
  247|       |
  248|  2.38k|    return (netsnmp_ds_booleans[storeid][which/8] & (1 << (which % 8))) ? 1:0;
  ------------------
  |  Branch (248:12): [True: 0, False: 2.38k]
  ------------------
  249|  2.38k|}
netsnmp_ds_get_int:
  268|     13|{
  269|     13|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|     26|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (269:9): [True: 0, False: 13]
  |  Branch (269:24): [True: 0, False: 13]
  ------------------
  270|     13|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|     13|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (270:2): [True: 0, False: 13]
  |  Branch (270:17): [True: 0, False: 13]
  ------------------
  271|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  272|      0|    }
  273|       |
  274|     13|    return netsnmp_ds_integers[storeid][which];
  275|     13|}
netsnmp_ds_set_string:
  279|      1|{
  280|      1|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|      2|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (280:9): [True: 0, False: 1]
  |  Branch (280:24): [True: 0, False: 1]
  ------------------
  281|      1|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|      1|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (281:2): [True: 0, False: 1]
  |  Branch (281:17): [True: 0, False: 1]
  ------------------
  282|      0|        return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
  283|      0|    }
  284|       |
  285|      1|    DEBUGMSGTL(("netsnmp_ds_set_string", "Setting %s:%d = \"%s\"\n",
  ------------------
  |  |   68|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (166:52): [True: 0, False: 0]
  |  |  |  |  |  Branch (166:64): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
  286|      1|                stores[storeid], which, (value ? value : "(null)")));
  287|       |
  288|       |    /*
  289|       |     * is some silly person is calling us with our own pointer?
  290|       |     */
  291|      1|    if (netsnmp_ds_strings[storeid][which] == value)
  ------------------
  |  Branch (291:9): [True: 0, False: 1]
  ------------------
  292|      0|        return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      0|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  293|       |
  294|      1|    snmp_res_lock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   79|      1|#define snmp_res_lock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (79:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
  295|      1|    if (netsnmp_ds_strings[storeid][which] != NULL) {
  ------------------
  |  Branch (295:9): [True: 0, False: 1]
  ------------------
  296|      0|        free(netsnmp_ds_strings[storeid][which]);
  297|      0|	netsnmp_ds_strings[storeid][which] = NULL;
  298|      0|    }
  299|      1|    snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_SESSION);
  ------------------
  |  |   80|      1|#define snmp_res_unlock(x,y) do {} while (0)
  |  |  ------------------
  |  |  |  Branch (80:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  300|       |
  301|      1|    if (value) {
  ------------------
  |  Branch (301:9): [True: 1, False: 0]
  ------------------
  302|      1|        netsnmp_ds_strings[storeid][which] = strdup(value);
  303|      1|    } else {
  304|      0|        netsnmp_ds_strings[storeid][which] = NULL;
  305|      0|    }
  306|       |
  307|      1|    return SNMPERR_SUCCESS;
  ------------------
  |  |  217|      1|#define SNMPERR_SUCCESS			(0)     /* XXX  Non-PDU "success" code. */
  ------------------
  308|      1|}
netsnmp_ds_get_string:
  312|  1.22k|{
  313|  1.22k|    if (storeid < 0 || storeid >= NETSNMP_DS_MAX_IDS || 
  ------------------
  |  |   38|  2.45k|#define NETSNMP_DS_MAX_IDS 3
  ------------------
  |  Branch (313:9): [True: 0, False: 1.22k]
  |  Branch (313:24): [True: 0, False: 1.22k]
  ------------------
  314|  1.22k|	which   < 0 || which   >= NETSNMP_DS_MAX_SUBIDS) {
  ------------------
  |  |   39|  1.22k|#define NETSNMP_DS_MAX_SUBIDS 64        /* needs to be a multiple of 8 */
  ------------------
  |  Branch (314:2): [True: 0, False: 1.22k]
  |  Branch (314:17): [True: 0, False: 1.22k]
  ------------------
  315|      0|        return NULL;
  316|      0|    }
  317|       |
  318|  1.22k|    return netsnmp_ds_strings[storeid][which];
  319|  1.22k|}

get_tree_head:
 2129|     26|{
 2130|     26|    return (tree_head);
 2131|     26|}
netsnmp_set_mib_directory:
 2522|      1|{
 2523|      1|    const char *newdir;
 2524|      1|    char *olddir, *tmpdir = NULL;
 2525|       |
 2526|      1|    DEBUGTRACE;
  ------------------
  |  |   65|      1|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  146|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (65:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2527|      1|    if (NULL == dir) {
  ------------------
  |  Branch (2527:9): [True: 0, False: 1]
  ------------------
 2528|      0|        return;
 2529|      0|    }
 2530|       |    
 2531|      1|    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 2532|      1|				   NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2533|      1|    if (olddir) {
  ------------------
  |  Branch (2533:9): [True: 0, False: 1]
  ------------------
 2534|      0|        if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2534:13): [True: 0, False: 0]
  |  Branch (2534:30): [True: 0, False: 0]
  ------------------
 2535|       |            /** New dir starts with '+', thus we add it. */
 2536|      0|            tmpdir = (char *)malloc(strlen(dir) + strlen(olddir) + 2);
 2537|      0|            if (!tmpdir) {
  ------------------
  |  Branch (2537:17): [True: 0, False: 0]
  ------------------
 2538|      0|                DEBUGMSGTL(("read_config:initmib", "set mibdir malloc failed"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2539|      0|                return;
 2540|      0|            }
 2541|      0|            if (*dir++ == '+')
  ------------------
  |  Branch (2541:17): [True: 0, False: 0]
  ------------------
 2542|      0|                sprintf(tmpdir, "%s%c%s", olddir, ENV_SEPARATOR_CHAR, dir);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2543|      0|            else
 2544|      0|                sprintf(tmpdir, "%s%c%s", dir, ENV_SEPARATOR_CHAR, olddir);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2545|      0|            newdir = tmpdir;
 2546|      0|        } else {
 2547|      0|            newdir = dir;
 2548|      0|        }
 2549|      1|    } else {
 2550|       |        /** If dir starts with '+' skip '+' it. */
 2551|      1|        newdir = ((*dir == '+') ? ++dir : dir);
  ------------------
  |  Branch (2551:19): [True: 0, False: 1]
  ------------------
 2552|      1|    }
 2553|      1|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2554|      1|                          newdir);
 2555|       |
 2556|       |    /** set_string calls strdup, so if we allocated memory, free it */
 2557|      1|    if (tmpdir == newdir) {
  ------------------
  |  Branch (2557:9): [True: 0, False: 1]
  ------------------
 2558|      0|        SNMP_FREE(tmpdir);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2559|      0|    }
 2560|      1|}
netsnmp_get_mib_directory:
 2577|      1|{
 2578|      1|    char *dir;
 2579|       |
 2580|      1|    DEBUGTRACE;
  ------------------
  |  |   65|      1|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  146|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (65:67): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2581|      1|    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2582|      1|    if (dir == NULL) {
  ------------------
  |  Branch (2582:9): [True: 1, False: 0]
  ------------------
 2583|      1|        DEBUGMSGTL(("get_mib_directory", "no mib directories set\n"));
  ------------------
  |  |   68|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2584|       |
 2585|       |        /** Check if the environment variable is set */
 2586|      1|        dir = netsnmp_getenv("MIBDIRS");
 2587|      1|        if (dir == NULL) {
  ------------------
  |  Branch (2587:13): [True: 1, False: 0]
  ------------------
 2588|      1|            DEBUGMSGTL(("get_mib_directory", "no mib directories set by environment\n"));
  ------------------
  |  |   68|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2589|       |            /** Not set use hard coded path */
 2590|      1|            if (confmibdir == NULL) {
  ------------------
  |  Branch (2590:17): [True: 1, False: 0]
  ------------------
 2591|      1|                DEBUGMSGTL(("get_mib_directory", "no mib directories set by config\n"));
  ------------------
  |  |   68|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2592|      1|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1623|      1|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2593|      1|            }
 2594|      0|            else if ((*confmibdir == '+') || (*confmibdir == '-')) {
  ------------------
  |  Branch (2594:22): [True: 0, False: 0]
  |  Branch (2594:46): [True: 0, False: 0]
  ------------------
 2595|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config (but added)\n"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2596|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1623|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2597|      0|                netsnmp_set_mib_directory(confmibdir);
 2598|      0|            }
 2599|      0|            else {
 2600|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config\n"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2601|      0|                netsnmp_set_mib_directory(confmibdir);
 2602|      0|            }
 2603|      1|        } else if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2603:20): [True: 0, False: 0]
  |  Branch (2603:37): [True: 0, False: 0]
  ------------------
 2604|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment (but added)\n"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2605|      0|            netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1623|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2606|      0|            netsnmp_set_mib_directory(dir);
 2607|      0|        } else {
 2608|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment\n"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2609|      0|            netsnmp_set_mib_directory(dir);
 2610|      0|        }
 2611|      1|        dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      1|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2612|      1|    }
 2613|      1|    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
  ------------------
  |  |   68|      1|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      1|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2614|      1|    return(dir);
 2615|      1|}
set_function:
 2910|      3|{
 2911|      3|    subtree->printer = NULL;
 2912|      3|    switch (subtree->type) {
 2913|      0|    case TYPE_OBJID:
  ------------------
  |  |  154|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (2913:5): [True: 0, False: 3]
  ------------------
 2914|      0|        subtree->printomat = sprint_realloc_object_identifier;
 2915|      0|        break;
 2916|      0|    case TYPE_OCTETSTR:
  ------------------
  |  |  155|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (2916:5): [True: 0, False: 3]
  ------------------
 2917|      0|        subtree->printomat = sprint_realloc_octet_string;
 2918|      0|        break;
 2919|      0|    case TYPE_INTEGER:
  ------------------
  |  |  156|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (2919:5): [True: 0, False: 3]
  ------------------
 2920|      0|        subtree->printomat = sprint_realloc_integer;
 2921|      0|        break;
 2922|      0|    case TYPE_INTEGER32:
  ------------------
  |  |  169|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (2922:5): [True: 0, False: 3]
  ------------------
 2923|      0|        subtree->printomat = sprint_realloc_integer;
 2924|      0|        break;
 2925|      0|    case TYPE_NETADDR:
  ------------------
  |  |  157|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (2925:5): [True: 0, False: 3]
  ------------------
 2926|      0|        subtree->printomat = sprint_realloc_networkaddress;
 2927|      0|        break;
 2928|      0|    case TYPE_IPADDR:
  ------------------
  |  |  158|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (2928:5): [True: 0, False: 3]
  ------------------
 2929|      0|        subtree->printomat = sprint_realloc_ipaddress;
 2930|      0|        break;
 2931|      0|    case TYPE_COUNTER:
  ------------------
  |  |  159|      0|#define TYPE_COUNTER        6
  ------------------
  |  Branch (2931:5): [True: 0, False: 3]
  ------------------
 2932|      0|        subtree->printomat = sprint_realloc_counter;
 2933|      0|        break;
 2934|      0|    case TYPE_GAUGE:
  ------------------
  |  |  160|      0|#define TYPE_GAUGE          7
  ------------------
  |  Branch (2934:5): [True: 0, False: 3]
  ------------------
 2935|      0|        subtree->printomat = sprint_realloc_gauge;
 2936|      0|        break;
 2937|      0|    case TYPE_TIMETICKS:
  ------------------
  |  |  161|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (2937:5): [True: 0, False: 3]
  ------------------
 2938|      0|        subtree->printomat = sprint_realloc_timeticks;
 2939|      0|        break;
 2940|      0|    case TYPE_OPAQUE:
  ------------------
  |  |  162|      0|#define TYPE_OPAQUE         9
  ------------------
  |  Branch (2940:5): [True: 0, False: 3]
  ------------------
 2941|      0|        subtree->printomat = sprint_realloc_opaque;
 2942|      0|        break;
 2943|      0|    case TYPE_NULL:
  ------------------
  |  |  163|      0|#define TYPE_NULL           10
  ------------------
  |  Branch (2943:5): [True: 0, False: 3]
  ------------------
 2944|      0|        subtree->printomat = sprint_realloc_null;
 2945|      0|        break;
 2946|      0|    case TYPE_BITSTRING:
  ------------------
  |  |  165|      0|#define TYPE_BITSTRING      12
  ------------------
  |  Branch (2946:5): [True: 0, False: 3]
  ------------------
 2947|      0|        subtree->printomat = sprint_realloc_bitstring;
 2948|      0|        break;
 2949|      0|    case TYPE_NSAPADDRESS:
  ------------------
  |  |  166|      0|#define TYPE_NSAPADDRESS    13
  ------------------
  |  Branch (2949:5): [True: 0, False: 3]
  ------------------
 2950|      0|        subtree->printomat = sprint_realloc_nsapaddress;
 2951|      0|        break;
 2952|      0|    case TYPE_COUNTER64:
  ------------------
  |  |  164|      0|#define TYPE_COUNTER64      11
  ------------------
  |  Branch (2952:5): [True: 0, False: 3]
  ------------------
 2953|      0|        subtree->printomat = sprint_realloc_counter64;
 2954|      0|        break;
 2955|      0|    case TYPE_UINTEGER:
  ------------------
  |  |  167|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (2955:5): [True: 0, False: 3]
  ------------------
 2956|      0|        subtree->printomat = sprint_realloc_uinteger;
 2957|      0|        break;
 2958|      0|    case TYPE_UNSIGNED32:
  ------------------
  |  |  168|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (2958:5): [True: 0, False: 3]
  ------------------
 2959|      0|        subtree->printomat = sprint_realloc_gauge;
 2960|      0|        break;
 2961|      3|    case TYPE_OTHER:
  ------------------
  |  |  153|      3|#define TYPE_OTHER          0
  ------------------
  |  Branch (2961:5): [True: 3, False: 0]
  ------------------
 2962|      3|    default:
  ------------------
  |  Branch (2962:5): [True: 0, False: 3]
  ------------------
 2963|      3|        subtree->printomat = sprint_realloc_by_type;
 2964|      3|        break;
 2965|      3|    }
 2966|      3|}
read_objid:
 2987|    410|{
 2988|    410|#ifndef NETSNMP_DISABLE_MIB_LOADING
 2989|    410|    struct tree    *root = tree_top;
 2990|    410|    char            buf[SPRINT_MAX_LEN];
 2991|    410|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 2992|    410|    int             ret, max_out_len;
 2993|    410|    char           *name, ch;
 2994|    410|    const char     *cp;
 2995|       |
 2996|    410|    cp = input;
 2997|  2.79k|    while ((ch = *cp)) {
  ------------------
  |  Branch (2997:12): [True: 2.70k, False: 85]
  ------------------
 2998|  2.70k|        if (('0' <= ch && ch <= '9')
  ------------------
  |  Branch (2998:14): [True: 2.05k, False: 648]
  |  Branch (2998:27): [True: 341, False: 1.71k]
  ------------------
 2999|  2.70k|            || ('a' <= ch && ch <= 'z')
  ------------------
  |  Branch (2999:17): [True: 1.45k, False: 911]
  |  Branch (2999:30): [True: 1.43k, False: 14]
  ------------------
 3000|  2.70k|            || ('A' <= ch && ch <= 'Z')
  ------------------
  |  Branch (3000:17): [True: 268, False: 657]
  |  Branch (3000:30): [True: 245, False: 23]
  ------------------
 3001|  2.70k|            || ch == '-')
  ------------------
  |  Branch (3001:16): [True: 355, False: 325]
  ------------------
 3002|  2.38k|            cp++;
 3003|    325|        else
 3004|    325|            break;
 3005|  2.70k|    }
 3006|    410|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3007|    410|    if (ch == ':')
  ------------------
  |  Branch (3007:9): [True: 0, False: 410]
  ------------------
 3008|      0|        return get_node(input, output, out_len);
 3009|    410|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3010|       |
 3011|    410|    if (*input == '.')
  ------------------
  |  Branch (3011:9): [True: 6, False: 404]
  ------------------
 3012|      6|        input++;
 3013|    404|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3014|    404|    else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID)) {
  ------------------
  |  |   48|    404|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID)) {
  ------------------
  |  |   85|    404|#define NETSNMP_DS_LIB_READ_UCD_STYLE_OID  25   /* require top-level OIDs to be prefixed with a dot */
  ------------------
  |  Branch (3014:14): [True: 0, False: 404]
  ------------------
 3015|       |        /*
 3016|       |         * get past leading '.', append '.' to Prefix. 
 3017|       |         */
 3018|      0|        if (*Prefix == '.')
  ------------------
  |  Branch (3018:13): [True: 0, False: 0]
  ------------------
 3019|      0|            strlcpy(buf, Prefix + 1, sizeof(buf));
 3020|      0|        else
 3021|      0|            strlcpy(buf, Prefix, sizeof(buf));
 3022|      0|        strlcat(buf, ".", sizeof(buf));
 3023|      0|        strlcat(buf, input, sizeof(buf));
 3024|      0|        input = buf;
 3025|      0|    }
 3026|    410|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3027|       |
 3028|    410|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3029|    410|    if ((root == NULL) && (tree_head != NULL)) {
  ------------------
  |  Branch (3029:9): [True: 410, False: 0]
  |  Branch (3029:27): [True: 383, False: 27]
  ------------------
 3030|    383|        root = tree_head;
 3031|    383|    }
 3032|     27|    else if (root == NULL) {
  ------------------
  |  Branch (3032:14): [True: 27, False: 0]
  ------------------
 3033|     27|        SET_SNMP_ERROR(SNMPERR_NOMIB);
  ------------------
  |  |   56|     27|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3034|     27|        *out_len = 0;
 3035|     27|        return 0;
 3036|     27|    }
 3037|    383|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3038|    383|    name = strdup(input);
 3039|    383|    max_out_len = *out_len;
 3040|    383|    *out_len = 0;
 3041|    383|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3042|    383|    if ((ret =
  ------------------
  |  Branch (3042:9): [True: 306, False: 77]
  ------------------
 3043|    383|         _add_strings_to_oid(root, name, output, out_len,
 3044|    383|                             max_out_len)) <= 0)
 3045|       |#else
 3046|       |    if ((ret =
 3047|       |         _add_strings_to_oid(NULL, name, output, out_len,
 3048|       |                             max_out_len)) <= 0)
 3049|       |#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3050|    306|    {
 3051|    306|        if (ret == 0)
  ------------------
  |  Branch (3051:13): [True: 306, False: 0]
  ------------------
 3052|    306|            ret = SNMPERR_UNKNOWN_OBJID;
  ------------------
  |  |  275|    306|#define SNMPERR_UNKNOWN_OBJID		(-58)
  ------------------
 3053|    306|        SET_SNMP_ERROR(ret);
  ------------------
  |  |   56|    306|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3054|    306|        SNMP_FREE(name);
  ------------------
  |  |   62|    306|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 306, False: 0]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3055|    306|        return 0;
 3056|    306|    }
 3057|     77|    SNMP_FREE(name);
  ------------------
  |  |   62|     77|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 77, False: 0]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3058|       |
 3059|     77|    return 1;
 3060|    383|}
get_module_node:
 5156|    556|{
 5157|    556|    int             modid, rc = 0;
 5158|    556|    struct tree    *tp;
 5159|    556|    char           *name, *cp;
 5160|       |
 5161|    556|    if (!strcmp(module, "ANY"))
  ------------------
  |  Branch (5161:9): [True: 358, False: 198]
  ------------------
 5162|    358|        modid = -1;
 5163|    198|    else {
 5164|    198|        netsnmp_read_module(module);
 5165|    198|        modid = which_module(module);
 5166|    198|        if (modid == -1)
  ------------------
  |  Branch (5166:13): [True: 198, False: 0]
  ------------------
 5167|    198|            return 0;
 5168|    198|    }
 5169|       |
 5170|       |    /*
 5171|       |     * Isolate the first component of the name ... 
 5172|       |     */
 5173|    358|    name = strdup(fname);
 5174|    358|    cp = strchr(name, '.');
 5175|    358|    if (cp != NULL) {
  ------------------
  |  Branch (5175:9): [True: 69, False: 289]
  ------------------
 5176|     69|        *cp = '\0';
 5177|     69|        cp++;
 5178|     69|    }
 5179|       |    /*
 5180|       |     * ... and locate it in the tree. 
 5181|       |     */
 5182|    358|    tp = find_tree_node(name, modid);
 5183|    358|    if (tp) {
  ------------------
  |  Branch (5183:9): [True: 26, False: 332]
  ------------------
 5184|     26|        size_t          maxlen = *objidlen;
 5185|       |
 5186|       |        /*
 5187|       |         * Set the first element of the object ID 
 5188|       |         */
 5189|     26|        if (node_to_oid(tp, objid, objidlen)) {
  ------------------
  |  Branch (5189:13): [True: 26, False: 0]
  ------------------
 5190|     26|            rc = 1;
 5191|       |
 5192|       |            /*
 5193|       |             * If the name requested was more than one element,
 5194|       |             * tag on the rest of the components 
 5195|       |             */
 5196|     26|            if (cp != NULL)
  ------------------
  |  Branch (5196:17): [True: 2, False: 24]
  ------------------
 5197|      2|                rc = _add_strings_to_oid(tp, cp, objid, objidlen, maxlen);
 5198|     26|        }
 5199|     26|    }
 5200|       |
 5201|    358|    SNMP_FREE(name);
  ------------------
  |  |   62|    358|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 358, False: 0]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5202|    358|    return (rc);
 5203|    556|}
get_wild_node:
 5696|    332|{
 5697|    332|    struct tree    *tp = find_best_tree_node(name, tree_head, NULL);
 5698|    332|    if (!tp)
  ------------------
  |  Branch (5698:9): [True: 310, False: 22]
  ------------------
 5699|    310|        return 0;
 5700|     22|    return get_node(tp->label, objid, objidlen);
 5701|    332|}
get_node:
 5705|    556|{
 5706|    556|    const char     *cp;
 5707|    556|    char            ch;
 5708|    556|    int             res;
 5709|       |
 5710|    556|    cp = name;
 5711|  7.75k|    while ((ch = *cp))
  ------------------
  |  Branch (5711:12): [True: 7.65k, False: 99]
  ------------------
 5712|  7.65k|        if (('0' <= ch && ch <= '9')
  ------------------
  |  Branch (5712:14): [True: 6.73k, False: 922]
  |  Branch (5712:27): [True: 1.05k, False: 5.67k]
  ------------------
 5713|  7.65k|            || ('a' <= ch && ch <= 'z')
  ------------------
  |  Branch (5713:17): [True: 4.31k, False: 2.28k]
  |  Branch (5713:30): [True: 4.30k, False: 14]
  ------------------
 5714|  7.65k|            || ('A' <= ch && ch <= 'Z')
  ------------------
  |  Branch (5714:17): [True: 1.16k, False: 1.13k]
  |  Branch (5714:30): [True: 1.14k, False: 23]
  ------------------
 5715|  7.65k|            || ch == '-')
  ------------------
  |  Branch (5715:16): [True: 696, False: 457]
  ------------------
 5716|  7.19k|            cp++;
 5717|    457|        else
 5718|    457|            break;
 5719|    556|    if (ch != ':')
  ------------------
  |  Branch (5719:9): [True: 357, False: 199]
  ------------------
 5720|    357|        if (*name == '.')
  ------------------
  |  Branch (5720:13): [True: 4, False: 353]
  ------------------
 5721|      4|            res = get_module_node(name + 1, "ANY", objid, objidlen);
 5722|    353|        else
 5723|    353|            res = get_module_node(name, "ANY", objid, objidlen);
 5724|    199|    else {
 5725|    199|        char           *module;
 5726|       |        /*
 5727|       |         *  requested name is of the form
 5728|       |         *      "module:subidentifier"
 5729|       |         */
 5730|    199|        module = (char *) malloc((size_t) (cp - name + 1));
 5731|    199|        if (!module)
  ------------------
  |  Branch (5731:13): [True: 0, False: 199]
  ------------------
 5732|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  218|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5733|    199|        sprintf(module, "%.*s", (int) (cp - name), name);
 5734|    199|        cp++;                   /* cp now point to the subidentifier */
 5735|    199|        if (*cp == ':')
  ------------------
  |  Branch (5735:13): [True: 1, False: 198]
  ------------------
 5736|      1|            cp++;
 5737|       |
 5738|       |        /*
 5739|       |         * 'cp' and 'name' *do* go that way round! 
 5740|       |         */
 5741|    199|        res = get_module_node(cp, module, objid, objidlen);
 5742|    199|        SNMP_FREE(module);
  ------------------
  |  |   62|    199|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 199, False: 0]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5743|    199|    }
 5744|    556|    if (res == 0) {
  ------------------
  |  Branch (5744:9): [True: 532, False: 24]
  ------------------
 5745|    532|        SET_SNMP_ERROR(SNMPERR_UNKNOWN_OBJID);
  ------------------
  |  |   56|    532|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 5746|    532|    }
 5747|       |
 5748|    556|    return res;
 5749|    556|}
clear_tree_flags:
 5786|    332|{
 5787|  1.24k|    for (; tp; tp = tp->next_peer) {
  ------------------
  |  Branch (5787:12): [True: 915, False: 332]
  ------------------
 5788|    915|        tp->reported = 0;
 5789|    915|        if (tp->child_list)
  ------------------
  |  Branch (5789:13): [True: 0, False: 915]
  ------------------
 5790|      0|            clear_tree_flags(tp->child_list);
 5791|    915|     /*RECURSE*/}
 5792|    332|}
snmp_parse_oid:
 6045|    611|{
 6046|    611|#ifndef NETSNMP_DISABLE_MIB_LOADING
 6047|    611|    size_t          savlen = *rootlen;
 6048|    611|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 6049|    611|    char           *tmpbuf = NULL;
 6050|    611|    const char     *suffix, *prefix;
 6051|       |
 6052|    611|    suffix = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    611|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 6053|    611|                                   NETSNMP_DS_LIB_OIDSUFFIX);
  ------------------
  |  |  163|    611|#define NETSNMP_DS_LIB_OIDSUFFIX         12
  ------------------
 6054|    611|    prefix = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    611|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 6055|    611|                                   NETSNMP_DS_LIB_OIDPREFIX);
  ------------------
  |  |  164|    611|#define NETSNMP_DS_LIB_OIDPREFIX         13
  ------------------
 6056|    611|    if ((suffix && suffix[0]) || (prefix && prefix[0])) {
  ------------------
  |  Branch (6056:10): [True: 0, False: 611]
  |  Branch (6056:20): [True: 0, False: 0]
  |  Branch (6056:35): [True: 0, False: 611]
  |  Branch (6056:45): [True: 0, False: 0]
  ------------------
 6057|      0|        if (!suffix)
  ------------------
  |  Branch (6057:13): [True: 0, False: 0]
  ------------------
 6058|      0|            suffix = "";
 6059|      0|        if (!prefix)
  ------------------
  |  Branch (6059:13): [True: 0, False: 0]
  ------------------
 6060|      0|            prefix = "";
 6061|      0|        if (asprintf(&tmpbuf, "%s%s%s%s", prefix, argv,
  ------------------
  |  Branch (6061:13): [True: 0, False: 0]
  ------------------
 6062|      0|                     suffix[0] == '.' || suffix[0] == '\0' ? "" : ".",
  ------------------
  |  Branch (6062:22): [True: 0, False: 0]
  |  Branch (6062:42): [True: 0, False: 0]
  ------------------
 6063|      0|                     suffix) < 0) {
 6064|      0|            DEBUGMSGTL(("snmp_parse_oid", "Out of memory\n"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6065|      0|            return NULL;
 6066|      0|        }
 6067|      0|        argv = tmpbuf;
 6068|      0|        DEBUGMSGTL(("snmp_parse_oid","Parsing: %s\n",argv));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6069|      0|    }
 6070|       |
 6071|    611|#ifndef NETSNMP_DISABLE_MIB_LOADING
 6072|    611|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    611|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (6072:9): [True: 0, False: 611]
  ------------------
 6073|    611|                               NETSNMP_DS_LIB_RANDOM_ACCESS)
  ------------------
  |  |   74|    611|#define NETSNMP_DS_LIB_RANDOM_ACCESS	   14   /* random access to oid labels */
  ------------------
 6074|    611|        || strchr(argv, ':')) {
  ------------------
  |  Branch (6074:12): [True: 201, False: 410]
  ------------------
 6075|    201|        if (get_node(argv, root, rootlen))
  ------------------
  |  Branch (6075:13): [True: 1, False: 200]
  ------------------
 6076|      1|            goto out;
 6077|    410|    } else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    410|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (6077:16): [True: 0, False: 410]
  ------------------
 6078|    410|                                      NETSNMP_DS_LIB_REGEX_ACCESS)) {
  ------------------
  |  |   75|    410|#define NETSNMP_DS_LIB_REGEX_ACCESS	   15   /* regex matching to oid labels */
  ------------------
 6079|      0|	clear_tree_flags(tree_head);
 6080|      0|        if (get_wild_node(argv, root, rootlen))
  ------------------
  |  Branch (6080:13): [True: 0, False: 0]
  ------------------
 6081|      0|            goto out;
 6082|    410|    } else {
 6083|    410|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 6084|    410|        if (read_objid(argv, root, rootlen))
  ------------------
  |  Branch (6084:13): [True: 77, False: 333]
  ------------------
 6085|     77|            goto out;
 6086|    333|#ifndef NETSNMP_DISABLE_MIB_LOADING
 6087|    333|        *rootlen = savlen;
 6088|    333|        if (get_node(argv, root, rootlen))
  ------------------
  |  Branch (6088:13): [True: 1, False: 332]
  ------------------
 6089|      1|            goto out;
 6090|    332|        *rootlen = savlen;
 6091|    332|        DEBUGMSGTL(("parse_oid", "wildly parsing\n"));
  ------------------
  |  |   68|    332|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    332|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 332]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 6092|    332|	clear_tree_flags(tree_head);
 6093|    332|        if (get_wild_node(argv, root, rootlen))
  ------------------
  |  Branch (6093:13): [True: 22, False: 310]
  ------------------
 6094|     22|            goto out;
 6095|    332|    }
 6096|    510|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 6097|       |
 6098|    510|    root = NULL;
 6099|       |
 6100|    611|out:
 6101|    611|    free(tmpbuf);
 6102|    611|    return root;
 6103|    510|}
mib.c:node_to_oid:
 5225|     26|{
 5226|     26|    size_t          numids, lenids;
 5227|     26|    oid            *op;
 5228|       |
 5229|     26|    if (!tp || !objid || !objidlen)
  ------------------
  |  Branch (5229:9): [True: 0, False: 26]
  |  Branch (5229:16): [True: 0, False: 26]
  |  Branch (5229:26): [True: 0, False: 26]
  ------------------
 5230|      0|        return 0;
 5231|       |
 5232|     26|    lenids = *objidlen;
 5233|     26|    op = objid + lenids;        /* points after the last element */
 5234|       |
 5235|     52|    for (numids = 0; tp; tp = tp->parent, numids++) {
  ------------------
  |  Branch (5235:22): [True: 26, False: 26]
  ------------------
 5236|     26|        if (numids >= lenids)
  ------------------
  |  Branch (5236:13): [True: 0, False: 26]
  ------------------
 5237|      0|            continue;
 5238|     26|        --op;
 5239|     26|        *op = tp->subid;
 5240|     26|    }
 5241|       |
 5242|     26|    *objidlen = numids;
 5243|     26|    if (numids > lenids) {
  ------------------
  |  Branch (5243:9): [True: 0, False: 26]
  ------------------
 5244|      0|        return 0;
 5245|      0|    }
 5246|       |
 5247|     26|    if (numids < lenids)
  ------------------
  |  Branch (5247:9): [True: 26, False: 0]
  ------------------
 5248|     26|        memmove(objid, op, numids * sizeof(oid));
 5249|       |
 5250|     26|    return numids;
 5251|     26|}
mib.c:_add_strings_to_oid:
 5295|    385|{
 5296|    385|    oid             subid;
 5297|    385|    char           *fcp, *ecp, *cp2 = NULL;
 5298|    385|    char            doingquote;
 5299|    385|    int             len = -1;
 5300|    385|#ifndef NETSNMP_DISABLE_MIB_LOADING
 5301|    385|    struct tree    *tp2 = NULL;
 5302|    385|    struct index_list *in_dices = NULL;
 5303|    385|    int             pos = -1;
 5304|    385|    int             check =
 5305|    385|        !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   48|    385|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   76|    385|#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
  ------------------
 5306|    385|    int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   48|    385|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   90|    385|#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
  ------------------
 5307|    385|    int             len_index = 1000000;
 5308|       |
 5309|    385|    while (cp && tp && tp->child_list) {
  ------------------
  |  Branch (5309:12): [True: 385, False: 0]
  |  Branch (5309:18): [True: 385, False: 0]
  |  Branch (5309:24): [True: 0, False: 385]
  ------------------
 5310|      0|        fcp = cp;
 5311|      0|        tp2 = tp->child_list;
 5312|       |        /*
 5313|       |         * Isolate the next entry 
 5314|       |         */
 5315|      0|        cp2 = strchr(cp, '.');
 5316|      0|        if (cp2)
  ------------------
  |  Branch (5316:13): [True: 0, False: 0]
  ------------------
 5317|      0|            *cp2++ = '\0';
 5318|       |
 5319|       |        /*
 5320|       |         * Search for the appropriate child 
 5321|       |         */
 5322|      0|        if (isdigit((unsigned char)(*cp))) {
 5323|      0|            subid = strtoul(cp, &ecp, 0);
 5324|      0|            if (*ecp)
  ------------------
  |  Branch (5324:17): [True: 0, False: 0]
  ------------------
 5325|      0|                goto bad_id;
 5326|      0|            while (tp2 && tp2->subid != subid)
  ------------------
  |  Branch (5326:20): [True: 0, False: 0]
  |  Branch (5326:27): [True: 0, False: 0]
  ------------------
 5327|      0|                tp2 = tp2->next_peer;
 5328|      0|        } else {
 5329|      0|            while (tp2 && strcmp(tp2->label, fcp))
  ------------------
  |  Branch (5329:20): [True: 0, False: 0]
  |  Branch (5329:27): [True: 0, False: 0]
  ------------------
 5330|      0|                tp2 = tp2->next_peer;
 5331|      0|            if (!tp2)
  ------------------
  |  Branch (5331:17): [True: 0, False: 0]
  ------------------
 5332|      0|                goto bad_id;
 5333|      0|            subid = tp2->subid;
 5334|      0|        }
 5335|      0|        if (*objidlen >= maxlen)
  ------------------
  |  Branch (5335:13): [True: 0, False: 0]
  ------------------
 5336|      0|            goto bad_id;
 5337|      0|	while (tp2 && tp2->next_peer && tp2->next_peer->subid == subid)
  ------------------
  |  Branch (5337:9): [True: 0, False: 0]
  |  Branch (5337:16): [True: 0, False: 0]
  |  Branch (5337:34): [True: 0, False: 0]
  ------------------
 5338|      0|	    tp2 = tp2->next_peer;
 5339|      0|        objid[*objidlen] = subid;
 5340|      0|        (*objidlen)++;
 5341|       |
 5342|      0|        cp = cp2;
 5343|      0|        if (!tp2)
  ------------------
  |  Branch (5343:13): [True: 0, False: 0]
  ------------------
 5344|      0|            break;
 5345|      0|        tp = tp2;
 5346|      0|    }
 5347|       |
 5348|    385|    if (tp && !tp->child_list) {
  ------------------
  |  Branch (5348:9): [True: 385, False: 0]
  |  Branch (5348:15): [True: 385, False: 0]
  ------------------
 5349|    385|        if ((tp2 = tp->parent)) {
  ------------------
  |  Branch (5349:13): [True: 0, False: 385]
  ------------------
 5350|      0|            if (tp2->indexes)
  ------------------
  |  Branch (5350:17): [True: 0, False: 0]
  ------------------
 5351|      0|                in_dices = tp2->indexes;
 5352|      0|            else if (tp2->augments) {
  ------------------
  |  Branch (5352:22): [True: 0, False: 0]
  ------------------
 5353|      0|                tp2 = find_tree_node(tp2->augments, -1);
 5354|      0|                if (tp2)
  ------------------
  |  Branch (5354:21): [True: 0, False: 0]
  ------------------
 5355|      0|                    in_dices = tp2->indexes;
 5356|      0|            }
 5357|      0|        }
 5358|    385|        tp = NULL;
 5359|    385|    }
 5360|       |
 5361|    385|    while (cp && in_dices) {
  ------------------
  |  Branch (5361:12): [True: 385, False: 0]
  |  Branch (5361:18): [True: 0, False: 385]
  ------------------
 5362|      0|        fcp = cp;
 5363|       |
 5364|      0|        tp = find_tree_node(in_dices->ilabel, -1);
 5365|      0|        if (!tp)
  ------------------
  |  Branch (5365:13): [True: 0, False: 0]
  ------------------
 5366|      0|            break;
 5367|      0|        switch (tp->type) {
 5368|      0|        case TYPE_INTEGER:
  ------------------
  |  |  156|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (5368:9): [True: 0, False: 0]
  ------------------
 5369|      0|        case TYPE_INTEGER32:
  ------------------
  |  |  169|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (5369:9): [True: 0, False: 0]
  ------------------
 5370|      0|        case TYPE_UINTEGER:
  ------------------
  |  |  167|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (5370:9): [True: 0, False: 0]
  ------------------
 5371|      0|        case TYPE_UNSIGNED32:
  ------------------
  |  |  168|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (5371:9): [True: 0, False: 0]
  ------------------
 5372|      0|        case TYPE_TIMETICKS:
  ------------------
  |  |  161|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (5372:9): [True: 0, False: 0]
  ------------------
 5373|       |            /*
 5374|       |             * Isolate the next entry 
 5375|       |             */
 5376|      0|            cp2 = strchr(cp, '.');
 5377|      0|            if (cp2)
  ------------------
  |  Branch (5377:17): [True: 0, False: 0]
  ------------------
 5378|      0|                *cp2++ = '\0';
 5379|      0|            if (isdigit((unsigned char)(*cp))) {
 5380|      0|                subid = strtoul(cp, &ecp, 0);
 5381|      0|                if (*ecp)
  ------------------
  |  Branch (5381:21): [True: 0, False: 0]
  ------------------
 5382|      0|                    goto bad_id;
 5383|      0|            } else {
 5384|      0|                if (tp->enums) {
  ------------------
  |  Branch (5384:21): [True: 0, False: 0]
  ------------------
 5385|      0|                    struct enum_list *ep = tp->enums;
 5386|      0|                    while (ep && strcmp(ep->label, cp))
  ------------------
  |  Branch (5386:28): [True: 0, False: 0]
  |  Branch (5386:34): [True: 0, False: 0]
  ------------------
 5387|      0|                        ep = ep->next;
 5388|      0|                    if (!ep)
  ------------------
  |  Branch (5388:25): [True: 0, False: 0]
  ------------------
 5389|      0|                        goto bad_id;
 5390|      0|                    subid = ep->value;
 5391|      0|                } else
 5392|      0|                    goto bad_id;
 5393|      0|            }
 5394|      0|            if (check && tp->ranges) {
  ------------------
  |  Branch (5394:17): [True: 0, False: 0]
  |  Branch (5394:26): [True: 0, False: 0]
  ------------------
 5395|      0|                struct range_list *rp = tp->ranges;
 5396|      0|                int             ok = 0;
 5397|      0|                if (tp->type == TYPE_INTEGER ||
  ------------------
  |  |  156|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (5397:21): [True: 0, False: 0]
  ------------------
 5398|      0|                    tp->type == TYPE_INTEGER32) {
  ------------------
  |  |  169|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (5398:21): [True: 0, False: 0]
  ------------------
 5399|      0|                  while (!ok && rp) {
  ------------------
  |  Branch (5399:26): [True: 0, False: 0]
  |  Branch (5399:33): [True: 0, False: 0]
  ------------------
 5400|      0|                    if ((rp->low <= (int) subid)
  ------------------
  |  Branch (5400:25): [True: 0, False: 0]
  ------------------
 5401|      0|                        && ((int) subid <= rp->high))
  ------------------
  |  Branch (5401:28): [True: 0, False: 0]
  ------------------
 5402|      0|                        ok = 1;
 5403|      0|                    else
 5404|      0|                        rp = rp->next;
 5405|      0|                  }
 5406|      0|                } else { /* check unsigned range */
 5407|      0|                  while (!ok && rp) {
  ------------------
  |  Branch (5407:26): [True: 0, False: 0]
  |  Branch (5407:33): [True: 0, False: 0]
  ------------------
 5408|      0|                    if (((unsigned int)rp->low <= subid)
  ------------------
  |  Branch (5408:25): [True: 0, False: 0]
  ------------------
 5409|      0|                        && (subid <= (unsigned int)rp->high))
  ------------------
  |  Branch (5409:28): [True: 0, False: 0]
  ------------------
 5410|      0|                        ok = 1;
 5411|      0|                    else
 5412|      0|                        rp = rp->next;
 5413|      0|                  }
 5414|      0|                }
 5415|      0|                if (!ok)
  ------------------
  |  Branch (5415:21): [True: 0, False: 0]
  ------------------
 5416|      0|                    goto bad_id;
 5417|      0|            }
 5418|      0|            if (*objidlen >= maxlen)
  ------------------
  |  Branch (5418:17): [True: 0, False: 0]
  ------------------
 5419|      0|                goto bad_id;
 5420|      0|            objid[*objidlen] = subid;
 5421|      0|            (*objidlen)++;
 5422|      0|            break;
 5423|      0|        case TYPE_IPADDR:
  ------------------
  |  |  158|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (5423:9): [True: 0, False: 0]
  ------------------
 5424|      0|            if (*objidlen + 4 > maxlen)
  ------------------
  |  Branch (5424:17): [True: 0, False: 0]
  ------------------
 5425|      0|                goto bad_id;
 5426|      0|            for (subid = 0; cp && subid < 4; subid++) {
  ------------------
  |  Branch (5426:29): [True: 0, False: 0]
  |  Branch (5426:35): [True: 0, False: 0]
  ------------------
 5427|      0|                fcp = cp;
 5428|      0|                cp2 = strchr(cp, '.');
 5429|      0|                if (cp2)
  ------------------
  |  Branch (5429:21): [True: 0, False: 0]
  ------------------
 5430|      0|                    *cp2++ = 0;
 5431|      0|                objid[*objidlen] = strtoul(cp, &ecp, 0);
 5432|      0|                if (*ecp)
  ------------------
  |  Branch (5432:21): [True: 0, False: 0]
  ------------------
 5433|      0|                    goto bad_id;
 5434|      0|                if (check && objid[*objidlen] > 255)
  ------------------
  |  Branch (5434:21): [True: 0, False: 0]
  |  Branch (5434:30): [True: 0, False: 0]
  ------------------
 5435|      0|                    goto bad_id;
 5436|      0|                (*objidlen)++;
 5437|      0|                cp = cp2;
 5438|      0|            }
 5439|      0|            break;
 5440|      0|        case TYPE_OCTETSTR:
  ------------------
  |  |  155|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (5440:9): [True: 0, False: 0]
  ------------------
 5441|      0|            if (tp->ranges && !tp->ranges->next
  ------------------
  |  Branch (5441:17): [True: 0, False: 0]
  |  Branch (5441:31): [True: 0, False: 0]
  ------------------
 5442|      0|                && tp->ranges->low == tp->ranges->high)
  ------------------
  |  Branch (5442:20): [True: 0, False: 0]
  ------------------
 5443|      0|                len = tp->ranges->low;
 5444|      0|            else
 5445|      0|                len = -1;
 5446|      0|            pos = 0;
 5447|      0|            if (*cp == '"' || *cp == '\'') {
  ------------------
  |  Branch (5447:17): [True: 0, False: 0]
  |  Branch (5447:31): [True: 0, False: 0]
  ------------------
 5448|      0|                doingquote = *cp++;
 5449|       |                /*
 5450|       |                 * insert length if requested 
 5451|       |                 */
 5452|      0|                if (!in_dices->isimplied && len == -1) {
  ------------------
  |  Branch (5452:21): [True: 0, False: 0]
  |  Branch (5452:45): [True: 0, False: 0]
  ------------------
 5453|      0|                    if (doingquote == '\'') {
  ------------------
  |  Branch (5453:25): [True: 0, False: 0]
  ------------------
 5454|      0|                        snmp_set_detail
 5455|      0|                            ("'-quote is for fixed length strings");
 5456|      0|                        return 0;
 5457|      0|                    }
 5458|      0|                    if (*objidlen >= maxlen)
  ------------------
  |  Branch (5458:25): [True: 0, False: 0]
  ------------------
 5459|      0|                        goto bad_id;
 5460|      0|                    len_index = *objidlen;
 5461|      0|                    (*objidlen)++;
 5462|      0|                } else if (doingquote == '"') {
  ------------------
  |  Branch (5462:28): [True: 0, False: 0]
  ------------------
 5463|      0|                    snmp_set_detail
 5464|      0|                        ("\"-quote is for variable length strings");
 5465|      0|                    return 0;
 5466|      0|                }
 5467|       |
 5468|      0|		cp2 = _apply_escapes(cp, doingquote);
 5469|      0|		if (!cp2) goto bad_id;
  ------------------
  |  Branch (5469:7): [True: 0, False: 0]
  ------------------
 5470|      0|		else {
 5471|      0|		    unsigned char *new_val;
 5472|      0|		    int new_val_len;
 5473|      0|		    int parsed_hint = 0;
 5474|      0|		    const char *parsed_value;
 5475|       |
 5476|      0|		    if (do_hint && tp->hint) {
  ------------------
  |  Branch (5476:11): [True: 0, False: 0]
  |  Branch (5476:22): [True: 0, False: 0]
  ------------------
 5477|      0|			parsed_value = parse_octet_hint(tp->hint, cp,
 5478|      0|			                                &new_val, &new_val_len);
 5479|      0|			parsed_hint = parsed_value == NULL;
 5480|      0|		    }
 5481|      0|		    if (parsed_hint) {
  ------------------
  |  Branch (5481:11): [True: 0, False: 0]
  ------------------
 5482|      0|			int i;
 5483|      0|			for (i = 0; i < new_val_len; i++) {
  ------------------
  |  Branch (5483:16): [True: 0, False: 0]
  ------------------
 5484|      0|			    if (*objidlen >= maxlen) goto bad_id;
  ------------------
  |  Branch (5484:12): [True: 0, False: 0]
  ------------------
 5485|      0|			    objid[ *objidlen ] = new_val[i];
 5486|      0|			    (*objidlen)++;
 5487|      0|			    pos++;
 5488|      0|			}
 5489|      0|			SNMP_FREE(new_val);
  ------------------
  |  |   62|      0|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 0, False: 0]
  |  |  |  Branch (62:66): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5490|      0|		    } else {
 5491|      0|			while(*cp) {
  ------------------
  |  Branch (5491:10): [True: 0, False: 0]
  ------------------
 5492|      0|			    if (*objidlen >= maxlen) goto bad_id;
  ------------------
  |  Branch (5492:12): [True: 0, False: 0]
  ------------------
 5493|      0|			    objid[ *objidlen ] = *cp++;
 5494|      0|			    (*objidlen)++;
 5495|      0|			    pos++;
 5496|      0|			}
 5497|      0|		    }
 5498|      0|		}
 5499|       |		
 5500|      0|		cp2++;
 5501|      0|                if (!*cp2)
  ------------------
  |  Branch (5501:21): [True: 0, False: 0]
  ------------------
 5502|      0|                    cp2 = NULL;
 5503|      0|                else if (*cp2 != '.')
  ------------------
  |  Branch (5503:26): [True: 0, False: 0]
  ------------------
 5504|      0|                    goto bad_id;
 5505|      0|                else
 5506|      0|                    cp2++;
 5507|      0|		if (check) {
  ------------------
  |  Branch (5507:7): [True: 0, False: 0]
  ------------------
 5508|      0|                    if (len == -1) {
  ------------------
  |  Branch (5508:25): [True: 0, False: 0]
  ------------------
 5509|      0|                        struct range_list *rp = tp->ranges;
 5510|      0|                        int             ok = 0;
 5511|      0|                        while (rp && !ok)
  ------------------
  |  Branch (5511:32): [True: 0, False: 0]
  |  Branch (5511:38): [True: 0, False: 0]
  ------------------
 5512|      0|                            if (rp->low <= pos && pos <= rp->high)
  ------------------
  |  Branch (5512:33): [True: 0, False: 0]
  |  Branch (5512:51): [True: 0, False: 0]
  ------------------
 5513|      0|                                ok = 1;
 5514|      0|                            else
 5515|      0|                                rp = rp->next;
 5516|      0|                        if (!ok)
  ------------------
  |  Branch (5516:29): [True: 0, False: 0]
  ------------------
 5517|      0|                            goto bad_id;
 5518|      0|                        if (!in_dices->isimplied)
  ------------------
  |  Branch (5518:29): [True: 0, False: 0]
  ------------------
 5519|      0|                            objid[len_index] = pos;
 5520|      0|                    } else if (pos != len)
  ------------------
  |  Branch (5520:32): [True: 0, False: 0]
  ------------------
 5521|      0|                        goto bad_id;
 5522|      0|		}
 5523|      0|		else if (len == -1 && !in_dices->isimplied)
  ------------------
  |  Branch (5523:12): [True: 0, False: 0]
  |  Branch (5523:25): [True: 0, False: 0]
  ------------------
 5524|      0|		    objid[len_index] = pos;
 5525|      0|            } else {
 5526|      0|                if (!in_dices->isimplied && len == -1) {
  ------------------
  |  Branch (5526:21): [True: 0, False: 0]
  |  Branch (5526:45): [True: 0, False: 0]
  ------------------
 5527|      0|                    fcp = cp;
 5528|      0|                    cp2 = strchr(cp, '.');
 5529|      0|                    if (cp2)
  ------------------
  |  Branch (5529:25): [True: 0, False: 0]
  ------------------
 5530|      0|                        *cp2++ = 0;
 5531|      0|                    len = strtoul(cp, &ecp, 0);
 5532|      0|                    if (*ecp)
  ------------------
  |  Branch (5532:25): [True: 0, False: 0]
  ------------------
 5533|      0|                        goto bad_id;
 5534|      0|                    if (*objidlen + len + 1 >= maxlen)
  ------------------
  |  Branch (5534:25): [True: 0, False: 0]
  ------------------
 5535|      0|                        goto bad_id;
 5536|      0|                    objid[*objidlen] = len;
 5537|      0|                    (*objidlen)++;
 5538|      0|                    cp = cp2;
 5539|      0|                }
 5540|      0|                while (len && cp) {
  ------------------
  |  Branch (5540:24): [True: 0, False: 0]
  |  Branch (5540:31): [True: 0, False: 0]
  ------------------
 5541|      0|                    fcp = cp;
 5542|      0|                    cp2 = strchr(cp, '.');
 5543|      0|                    if (cp2)
  ------------------
  |  Branch (5543:25): [True: 0, False: 0]
  ------------------
 5544|      0|                        *cp2++ = 0;
 5545|      0|                    objid[*objidlen] = strtoul(cp, &ecp, 0);
 5546|      0|                    if (*ecp)
  ------------------
  |  Branch (5546:25): [True: 0, False: 0]
  ------------------
 5547|      0|                        goto bad_id;
 5548|      0|                    if (check && objid[*objidlen] > 255)
  ------------------
  |  Branch (5548:25): [True: 0, False: 0]
  |  Branch (5548:34): [True: 0, False: 0]
  ------------------
 5549|      0|                        goto bad_id;
 5550|      0|                    (*objidlen)++;
 5551|      0|                    len--;
 5552|      0|                    cp = cp2;
 5553|      0|                }
 5554|      0|            }
 5555|      0|            break;
 5556|      0|        case TYPE_OBJID:
  ------------------
  |  |  154|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (5556:9): [True: 0, False: 0]
  ------------------
 5557|      0|            in_dices = NULL;
 5558|      0|            cp2 = cp;
 5559|      0|            break;
 5560|      0|	case TYPE_NETADDR:
  ------------------
  |  |  157|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (5560:2): [True: 0, False: 0]
  ------------------
 5561|      0|	    fcp = cp;
 5562|      0|	    cp2 = strchr(cp, '.');
 5563|      0|	    if (cp2)
  ------------------
  |  Branch (5563:10): [True: 0, False: 0]
  ------------------
 5564|      0|		*cp2++ = 0;
 5565|      0|	    subid = strtoul(cp, &ecp, 0);
 5566|      0|	    if (*ecp)
  ------------------
  |  Branch (5566:10): [True: 0, False: 0]
  ------------------
 5567|      0|		goto bad_id;
 5568|      0|	    if (*objidlen + 1 >= maxlen)
  ------------------
  |  Branch (5568:10): [True: 0, False: 0]
  ------------------
 5569|      0|		goto bad_id;
 5570|      0|	    objid[*objidlen] = subid;
 5571|      0|	    (*objidlen)++;
 5572|      0|	    cp = cp2;
 5573|      0|	    if (subid == 1) {
  ------------------
  |  Branch (5573:10): [True: 0, False: 0]
  ------------------
 5574|      0|		for (len = 0; cp && len < 4; len++) {
  ------------------
  |  Branch (5574:17): [True: 0, False: 0]
  |  Branch (5574:23): [True: 0, False: 0]
  ------------------
 5575|      0|		    fcp = cp;
 5576|      0|		    cp2 = strchr(cp, '.');
 5577|      0|		    if (cp2)
  ------------------
  |  Branch (5577:11): [True: 0, False: 0]
  ------------------
 5578|      0|			*cp2++ = 0;
 5579|      0|		    subid = strtoul(cp, &ecp, 0);
 5580|      0|		    if (*ecp)
  ------------------
  |  Branch (5580:11): [True: 0, False: 0]
  ------------------
 5581|      0|			goto bad_id;
 5582|      0|		    if (*objidlen + 1 >= maxlen)
  ------------------
  |  Branch (5582:11): [True: 0, False: 0]
  ------------------
 5583|      0|			goto bad_id;
 5584|      0|		    if (check && subid > 255)
  ------------------
  |  Branch (5584:11): [True: 0, False: 0]
  |  Branch (5584:20): [True: 0, False: 0]
  ------------------
 5585|      0|			goto bad_id;
 5586|      0|		    objid[*objidlen] = subid;
 5587|      0|		    (*objidlen)++;
 5588|      0|		    cp = cp2;
 5589|      0|		}
 5590|      0|	    }
 5591|      0|	    else {
 5592|      0|		in_dices = NULL;
 5593|      0|	    }
 5594|      0|	    break;
 5595|      0|        default:
  ------------------
  |  Branch (5595:9): [True: 0, False: 0]
  ------------------
 5596|      0|            snmp_log(LOG_ERR, "Unexpected index type: %d %s %s\n",
 5597|      0|                     tp->type, in_dices->ilabel, cp);
 5598|      0|            in_dices = NULL;
 5599|      0|            cp2 = cp;
 5600|      0|            break;
 5601|      0|        }
 5602|      0|        cp = cp2;
 5603|      0|        if (in_dices)
  ------------------
  |  Branch (5603:13): [True: 0, False: 0]
  ------------------
 5604|      0|            in_dices = in_dices->next;
 5605|      0|    }
 5606|       |
 5607|    385|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 5608|  3.07k|    while (cp) {
  ------------------
  |  Branch (5608:12): [True: 3.00k, False: 77]
  ------------------
 5609|  3.00k|        fcp = cp;
 5610|  3.00k|        switch (*cp) {
 5611|    207|        case '0':
  ------------------
  |  Branch (5611:9): [True: 207, False: 2.79k]
  ------------------
 5612|    412|        case '1':
  ------------------
  |  Branch (5612:9): [True: 205, False: 2.79k]
  ------------------
 5613|    607|        case '2':
  ------------------
  |  Branch (5613:9): [True: 195, False: 2.80k]
  ------------------
 5614|    811|        case '3':
  ------------------
  |  Branch (5614:9): [True: 204, False: 2.79k]
  ------------------
 5615|  1.00k|        case '4':
  ------------------
  |  Branch (5615:9): [True: 195, False: 2.80k]
  ------------------
 5616|  1.23k|        case '5':
  ------------------
  |  Branch (5616:9): [True: 225, False: 2.77k]
  ------------------
 5617|  1.43k|        case '6':
  ------------------
  |  Branch (5617:9): [True: 199, False: 2.80k]
  ------------------
 5618|  1.64k|        case '7':
  ------------------
  |  Branch (5618:9): [True: 213, False: 2.78k]
  ------------------
 5619|  1.83k|        case '8':
  ------------------
  |  Branch (5619:9): [True: 193, False: 2.80k]
  ------------------
 5620|  2.03k|        case '9':
  ------------------
  |  Branch (5620:9): [True: 197, False: 2.80k]
  ------------------
 5621|  2.03k|            cp2 = strchr(cp, '.');
 5622|  2.03k|            if (cp2)
  ------------------
  |  Branch (5622:17): [True: 1.94k, False: 89]
  ------------------
 5623|  1.94k|                *cp2++ = 0;
 5624|  2.03k|            subid = strtoul(cp, &ecp, 0);
 5625|  2.03k|            if (*ecp)
  ------------------
  |  Branch (5625:17): [True: 16, False: 2.01k]
  ------------------
 5626|     16|                goto bad_id;
 5627|  2.01k|            if (*objidlen >= maxlen)
  ------------------
  |  Branch (5627:17): [True: 3, False: 2.01k]
  ------------------
 5628|      3|                goto bad_id;
 5629|  2.01k|            objid[*objidlen] = subid;
 5630|  2.01k|            (*objidlen)++;
 5631|  2.01k|            break;
 5632|    455|        case '"':
  ------------------
  |  Branch (5632:9): [True: 455, False: 2.54k]
  ------------------
 5633|    744|        case '\'':
  ------------------
  |  Branch (5633:9): [True: 289, False: 2.71k]
  ------------------
 5634|    744|            doingquote = *cp++;
 5635|    744|            if (*cp == '\0')
  ------------------
  |  Branch (5635:17): [True: 11, False: 733]
  ------------------
 5636|     11|                goto bad_id;
 5637|       |            /*
 5638|       |             * insert length if requested 
 5639|       |             */
 5640|    733|            if (doingquote == '"') {
  ------------------
  |  Branch (5640:17): [True: 450, False: 283]
  ------------------
 5641|    450|                if (*objidlen >= maxlen)
  ------------------
  |  Branch (5641:21): [True: 2, False: 448]
  ------------------
 5642|      2|                    goto bad_id;
 5643|    448|                objid[*objidlen] = len = strchr(cp, doingquote) - cp;
 5644|    448|                (*objidlen)++;
 5645|    448|            }
 5646|       |
 5647|  2.38k|            while (*cp && *cp != doingquote) {
  ------------------
  |  Branch (5647:20): [True: 2.35k, False: 34]
  |  Branch (5647:27): [True: 1.66k, False: 692]
  ------------------
 5648|  1.66k|                if (*objidlen >= maxlen)
  ------------------
  |  Branch (5648:21): [True: 5, False: 1.65k]
  ------------------
 5649|      5|                    goto bad_id;
 5650|  1.65k|                objid[*objidlen] = *cp++;
 5651|  1.65k|                (*objidlen)++;
 5652|  1.65k|            }
 5653|    726|            if (!*cp)
  ------------------
  |  Branch (5653:17): [True: 34, False: 692]
  ------------------
 5654|     34|                goto bad_id;
 5655|    692|            cp2 = cp + 1;
 5656|    692|            if (!*cp2)
  ------------------
  |  Branch (5656:17): [True: 7, False: 685]
  ------------------
 5657|      7|                cp2 = NULL;
 5658|    685|            else if (*cp2 == '.')
  ------------------
  |  Branch (5658:22): [True: 672, False: 13]
  ------------------
 5659|    672|                cp2++;
 5660|     13|            else
 5661|     13|                goto bad_id;
 5662|    679|            break;
 5663|    679|        default:
  ------------------
  |  Branch (5663:9): [True: 224, False: 2.77k]
  ------------------
 5664|    224|            goto bad_id;
 5665|  3.00k|        }
 5666|  2.69k|        cp = cp2;
 5667|  2.69k|    }
 5668|     77|    return 1;
 5669|       |
 5670|    308|  bad_id:
 5671|    308|    {
 5672|    308|        char            buf[256];
 5673|    308|#ifndef NETSNMP_DISABLE_MIB_LOADING
 5674|    308|        if (in_dices)
  ------------------
  |  Branch (5674:13): [True: 0, False: 308]
  ------------------
 5675|      0|            snprintf(buf, sizeof(buf), "Index out of range: %s (%s)",
 5676|      0|                    fcp, in_dices->ilabel);
 5677|    308|        else if (tp)
  ------------------
  |  Branch (5677:18): [True: 0, False: 308]
  ------------------
 5678|      0|            snprintf(buf, sizeof(buf), "Sub-id not found: %s -> %s", tp->label, fcp);
 5679|    308|        else
 5680|    308|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 5681|    308|            snprintf(buf, sizeof(buf), "%s", fcp);
 5682|    308|        buf[ sizeof(buf)-1 ] = 0;
 5683|       |
 5684|    308|        snmp_set_detail(buf);
 5685|    308|    }
 5686|    308|    return 0;
 5687|    385|}

netsnmp_init_mib_internals:
  699|    211|{
  700|    211|    register struct tok *tp;
  701|    211|    register int    b, i;
  702|    211|    int             max_modc;
  703|       |
  704|    211|    if (tree_head)
  ------------------
  |  Branch (704:9): [True: 210, False: 1]
  ------------------
  705|    210|        return;
  706|       |
  707|       |    /*
  708|       |     * Set up hash list of pre-defined tokens
  709|       |     */
  710|      1|    memset(buckets, 0, sizeof(buckets));
  711|     93|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (711:23): [True: 92, False: 1]
  ------------------
  712|     92|        tp->hash = name_hash(tp->name);
  713|     92|        b = BUCKET(tp->hash);
  ------------------
  |  |  526|     92|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  525|     92|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  714|     92|        if (buckets[b])
  ------------------
  |  Branch (714:13): [True: 60, False: 32]
  ------------------
  715|     60|            tp->next = buckets[b];      /* BUG ??? */
  716|     92|        buckets[b] = tp;
  717|     92|    }
  718|       |
  719|       |    /*
  720|       |     * Initialise other internal structures
  721|       |     */
  722|       |
  723|      1|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  724|     22|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (724:17): [True: 21, False: 1]
  ------------------
  725|     21|        module_map[i].next = &(module_map[i + 1]);
  726|      1|    module_map[max_modc].next = NULL;
  727|      1|    module_map_head = module_map;
  728|       |
  729|      1|    memset(nbuckets, 0, sizeof(nbuckets));
  730|      1|    memset(tbuckets, 0, sizeof(tbuckets));
  731|      1|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|      1|#define TC_INCR 100
  ------------------
  732|      1|    tclist = calloc(tc_alloc, sizeof(struct tc));
  733|      1|    build_translation_table();
  734|      1|    init_tree_roots();          /* Set up initial roots */
  735|       |    /*
  736|       |     * Relies on 'add_mibdir' having set up the modules 
  737|       |     */
  738|      1|}
find_tree_node:
 1240|    358|{
 1241|    358|    struct tree    *tp, *headtp;
 1242|    358|    int             count, *int_p;
 1243|       |
 1244|    358|    if (!name || !*name)
  ------------------
  |  Branch (1244:9): [True: 0, False: 358]
  |  Branch (1244:18): [True: 2, False: 356]
  ------------------
 1245|      2|        return (NULL);
 1246|       |
 1247|    356|    headtp = tbuckets[NBUCKET(name_hash(name))];
  ------------------
  |  |  529|    356|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  528|    356|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1248|    479|    for (tp = headtp; tp; tp = tp->next) {
  ------------------
  |  Branch (1248:23): [True: 149, False: 330]
  ------------------
 1249|    149|        if (tp->label && !label_compare(tp->label, name)) {
  ------------------
  |  | 1234|    149|#define	label_compare	strcmp
  ------------------
  |  Branch (1249:13): [True: 149, False: 0]
  |  Branch (1249:26): [True: 26, False: 123]
  ------------------
 1250|       |
 1251|     26|            if (modid == -1)    /* Any module */
  ------------------
  |  Branch (1251:17): [True: 26, False: 0]
  ------------------
 1252|     26|                return (tp);
 1253|       |
 1254|      0|            for (int_p = tp->module_list, count = 0;
 1255|      0|                 count < tp->number_modules; ++count, ++int_p)
  ------------------
  |  Branch (1255:18): [True: 0, False: 0]
  ------------------
 1256|      0|                if (*int_p == modid)
  ------------------
  |  Branch (1256:21): [True: 0, False: 0]
  ------------------
 1257|      0|                    return (tp);
 1258|      0|        }
 1259|    149|    }
 1260|       |
 1261|    330|    return (NULL);
 1262|    356|}
find_best_tree_node:
 1340|    332|{
 1341|    332|    struct tree    *tp, *best_so_far = NULL, *retptr;
 1342|    332|    u_int           old_match = MAX_BAD, new_match = MAX_BAD;
  ------------------
  |  | 1269|    332|#define MAX_BAD 0xffffff
  ------------------
                  u_int           old_match = MAX_BAD, new_match = MAX_BAD;
  ------------------
  |  | 1269|    332|#define MAX_BAD 0xffffff
  ------------------
 1343|       |
 1344|    332|    if (!pattrn || !*pattrn)
  ------------------
  |  Branch (1344:9): [True: 0, False: 332]
  |  Branch (1344:20): [True: 1, False: 331]
  ------------------
 1345|      1|        return (NULL);
 1346|       |
 1347|    331|    if (!tree_top)
  ------------------
  |  Branch (1347:9): [True: 26, False: 305]
  ------------------
 1348|     26|        tree_top = get_tree_head();
 1349|       |
 1350|  1.22k|    for (tp = tree_top; tp; tp = tp->next_peer) {
  ------------------
  |  Branch (1350:25): [True: 906, False: 322]
  ------------------
 1351|    906|        if (!tp->reported && tp->label)
  ------------------
  |  Branch (1351:13): [True: 906, False: 0]
  |  Branch (1351:30): [True: 906, False: 0]
  ------------------
 1352|    906|            new_match = compute_match(tp->label, pattrn);
 1353|    906|        tp->reported = 1;
 1354|       |
 1355|    906|        if (new_match < old_match) {
  ------------------
  |  Branch (1355:13): [True: 29, False: 877]
  ------------------
 1356|     29|            best_so_far = tp;
 1357|     29|            old_match = new_match;
 1358|     29|        }
 1359|    906|        if (new_match == 0)
  ------------------
  |  Branch (1359:13): [True: 9, False: 897]
  ------------------
 1360|      9|            break;              /* this is the best result we can get */
 1361|    897|        if (tp->child_list) {
  ------------------
  |  Branch (1361:13): [True: 0, False: 897]
  ------------------
 1362|      0|            retptr =
 1363|      0|                find_best_tree_node(pattrn, tp->child_list, &new_match);
 1364|      0|            if (new_match < old_match) {
  ------------------
  |  Branch (1364:17): [True: 0, False: 0]
  ------------------
 1365|      0|                best_so_far = retptr;
 1366|      0|                old_match = new_match;
 1367|      0|            }
 1368|      0|            if (new_match == 0)
  ------------------
  |  Branch (1368:17): [True: 0, False: 0]
  ------------------
 1369|      0|                break;          /* this is the best result we can get */
 1370|      0|        }
 1371|    897|    }
 1372|    331|    if (match)
  ------------------
  |  Branch (1372:9): [True: 0, False: 331]
  ------------------
 1373|      0|        *match = old_match;
 1374|    331|    return (best_so_far);
 1375|    332|}
which_module:
 3776|    201|{
 3777|    201|    struct module  *mp;
 3778|       |
 3779|    201|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3779:28): [True: 0, False: 201]
  ------------------
 3780|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1234|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3780:13): [True: 0, False: 0]
  ------------------
 3781|      0|            return (mp->modid);
 3782|       |
 3783|    201|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   68|    201|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|    201|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 201]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3784|    201|    return (-1);
 3785|    201|}
netsnmp_read_module:
 4049|    211|{
 4050|    211|    int status = 0;
 4051|    211|    status = read_module_internal(name);
 4052|       |
 4053|    211|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  512|    211|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4053:9): [True: 211, False: 0]
  ------------------
 4054|    211|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4054:13): [True: 198, False: 13]
  ------------------
 4055|    198|            print_module_not_found(name);
 4056|    211|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  519|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4056:16): [True: 0, False: 0]
  ------------------
 4057|      0|        gMibError = 0;
 4058|      0|        gLoop = 1;
 4059|       |
 4060|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4061|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4062|      0|    }
 4063|       |
 4064|    211|    return tree_head;
 4065|    211|}
parse.c:name_hash:
  686|    451|{
  687|    451|    int             hash = 0;
  688|    451|    const char     *cp;
  689|       |
  690|    451|    if (!name)
  ------------------
  |  Branch (690:9): [True: 0, False: 451]
  ------------------
  691|      0|        return 0;
  692|  6.42k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (692:21): [True: 5.97k, False: 451]
  ------------------
  693|  5.97k|        hash += tolower((unsigned char)(*cp));
  694|    451|    return (hash);
  695|    451|}
parse.c:build_translation_table:
 1069|      1|{
 1070|      1|    int             count;
 1071|       |
 1072|    257|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1072:21): [True: 256, False: 1]
  ------------------
 1073|    256|        switch (count) {
 1074|      1|        case OBJID:
  ------------------
  |  |  166|      1|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1074:9): [True: 1, False: 255]
  ------------------
 1075|      1|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  154|      1|#define TYPE_OBJID          1
  ------------------
 1076|      1|            break;
 1077|      1|        case OCTETSTR:
  ------------------
  |  |  167|      1|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1077:9): [True: 1, False: 255]
  ------------------
 1078|      1|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  155|      1|#define TYPE_OCTETSTR       2
  ------------------
 1079|      1|            break;
 1080|      1|        case INTEGER:
  ------------------
  |  |  168|      1|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1080:9): [True: 1, False: 255]
  ------------------
 1081|      1|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  156|      1|#define TYPE_INTEGER        3
  ------------------
 1082|      1|            break;
 1083|      1|        case NETADDR:
  ------------------
  |  |  169|      1|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1083:9): [True: 1, False: 255]
  ------------------
 1084|      1|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  157|      1|#define TYPE_NETADDR        4
  ------------------
 1085|      1|            break;
 1086|      1|        case IPADDR:
  ------------------
  |  |  170|      1|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1086:9): [True: 1, False: 255]
  ------------------
 1087|      1|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  158|      1|#define TYPE_IPADDR         5
  ------------------
 1088|      1|            break;
 1089|      1|        case COUNTER:
  ------------------
  |  |  171|      1|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1089:9): [True: 1, False: 255]
  ------------------
 1090|      1|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  159|      1|#define TYPE_COUNTER        6
  ------------------
 1091|      1|            break;
 1092|      1|        case GAUGE:
  ------------------
  |  |  172|      1|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1092:9): [True: 1, False: 255]
  ------------------
 1093|      1|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  160|      1|#define TYPE_GAUGE          7
  ------------------
 1094|      1|            break;
 1095|      1|        case TIMETICKS:
  ------------------
  |  |  173|      1|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1095:9): [True: 1, False: 255]
  ------------------
 1096|      1|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  161|      1|#define TYPE_TIMETICKS      8
  ------------------
 1097|      1|            break;
 1098|      1|        case KW_OPAQUE:
  ------------------
  |  |  174|      1|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1098:9): [True: 1, False: 255]
  ------------------
 1099|      1|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  162|      1|#define TYPE_OPAQUE         9
  ------------------
 1100|      1|            break;
 1101|      1|        case NUL:
  ------------------
  |  |  175|      1|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1101:9): [True: 1, False: 255]
  ------------------
 1102|      1|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  163|      1|#define TYPE_NULL           10
  ------------------
 1103|      1|            break;
 1104|      1|        case COUNTER64:
  ------------------
  |  |  210|      1|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1104:9): [True: 1, False: 255]
  ------------------
 1105|      1|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  164|      1|#define TYPE_COUNTER64      11
  ------------------
 1106|      1|            break;
 1107|      1|        case BITSTRING:
  ------------------
  |  |  208|      1|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1107:9): [True: 1, False: 255]
  ------------------
 1108|      1|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  165|      1|#define TYPE_BITSTRING      12
  ------------------
 1109|      1|            break;
 1110|      1|        case NSAPADDRESS:
  ------------------
  |  |  209|      1|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1110:9): [True: 1, False: 255]
  ------------------
 1111|      1|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  166|      1|#define TYPE_NSAPADDRESS    13
  ------------------
 1112|      1|            break;
 1113|      1|        case INTEGER32:
  ------------------
  |  |  273|      1|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1113:9): [True: 1, False: 255]
  ------------------
 1114|      1|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  169|      1|#define TYPE_INTEGER32      16
  ------------------
 1115|      1|            break;
 1116|      1|        case UINTEGER32:
  ------------------
  |  |  223|      1|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1116:9): [True: 1, False: 255]
  ------------------
 1117|      1|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  167|      1|#define TYPE_UINTEGER       14
  ------------------
 1118|      1|            break;
 1119|      1|        case UNSIGNED32:
  ------------------
  |  |  272|      1|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  156|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1119:9): [True: 1, False: 255]
  ------------------
 1120|      1|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  168|      1|#define TYPE_UNSIGNED32     15
  ------------------
 1121|      1|            break;
 1122|      1|        case TRAPTYPE:
  ------------------
  |  |  228|      1|#define TRAPTYPE    61
  ------------------
  |  Branch (1122:9): [True: 1, False: 255]
  ------------------
 1123|      1|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  173|      1|#define TYPE_TRAPTYPE	    20
  ------------------
 1124|      1|            break;
 1125|      1|        case NOTIFTYPE:
  ------------------
  |  |  212|      1|#define NOTIFTYPE   45
  ------------------
  |  Branch (1125:9): [True: 1, False: 255]
  ------------------
 1126|      1|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  174|      1|#define TYPE_NOTIFTYPE      21
  ------------------
 1127|      1|            break;
 1128|      1|        case NOTIFGROUP:
  ------------------
  |  |  257|      1|#define NOTIFGROUP  88
  ------------------
  |  Branch (1128:9): [True: 1, False: 255]
  ------------------
 1129|      1|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  176|      1|#define TYPE_NOTIFGROUP	    23
  ------------------
 1130|      1|            break;
 1131|      1|        case OBJGROUP:
  ------------------
  |  |  211|      1|#define OBJGROUP    44
  ------------------
  |  Branch (1131:9): [True: 1, False: 255]
  ------------------
 1132|      1|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  175|      1|#define TYPE_OBJGROUP	    22
  ------------------
 1133|      1|            break;
 1134|      1|        case MODULEIDENTITY:
  ------------------
  |  |  219|      1|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1134:9): [True: 1, False: 255]
  ------------------
 1135|      1|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  177|      1|#define TYPE_MODID	    24
  ------------------
 1136|      1|            break;
 1137|      1|        case OBJIDENTITY:
  ------------------
  |  |  274|      1|#define OBJIDENTITY	106
  ------------------
  |  Branch (1137:9): [True: 1, False: 255]
  ------------------
 1138|      1|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  180|      1|#define TYPE_OBJIDENTITY    27
  ------------------
 1139|      1|            break;
 1140|      1|        case AGENTCAP:
  ------------------
  |  |  242|      1|#define AGENTCAP    73
  ------------------
  |  Branch (1140:9): [True: 1, False: 255]
  ------------------
 1141|      1|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  178|      1|#define TYPE_AGENTCAP       25
  ------------------
 1142|      1|            break;
 1143|      1|        case COMPLIANCE:
  ------------------
  |  |  214|      1|#define COMPLIANCE  47
  ------------------
  |  Branch (1143:9): [True: 1, False: 255]
  ------------------
 1144|      1|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  179|      1|#define TYPE_MODCOMP        26
  ------------------
 1145|      1|            break;
 1146|    232|        default:
  ------------------
  |  Branch (1146:9): [True: 232, False: 24]
  ------------------
 1147|    232|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  153|    232|#define TYPE_OTHER          0
  ------------------
 1148|    232|            break;
 1149|    256|        }
 1150|    256|    }
 1151|      1|}
parse.c:init_tree_roots:
 1155|      1|{
 1156|      1|    struct tree    *tp, *lasttp;
 1157|      1|    int             base_modid;
 1158|      1|    int             hash;
 1159|       |
 1160|      1|    base_modid = which_module("SNMPv2-SMI");
 1161|      1|    if (base_modid == -1)
  ------------------
  |  Branch (1161:9): [True: 1, False: 0]
  ------------------
 1162|      1|        base_modid = which_module("RFC1155-SMI");
 1163|      1|    if (base_modid == -1)
  ------------------
  |  Branch (1163:9): [True: 1, False: 0]
  ------------------
 1164|      1|        base_modid = which_module("RFC1213-MIB");
 1165|       |
 1166|       |    /*
 1167|       |     * build root node 
 1168|       |     */
 1169|      1|    tp = calloc(1, sizeof(struct tree));
 1170|      1|    if (tp == NULL)
  ------------------
  |  Branch (1170:9): [True: 0, False: 1]
  ------------------
 1171|      0|        return;
 1172|      1|    tp->label = strdup("joint-iso-ccitt");
 1173|      1|    tp->modid = base_modid;
 1174|      1|    tp->number_modules = 1;
 1175|      1|    tp->module_list = &(tp->modid);
 1176|      1|    tp->subid = 2;
 1177|      1|    tp->tc_index = -1;
 1178|      1|    set_function(tp);           /* from mib.c */
 1179|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  529|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  528|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1180|      1|    tp->next = tbuckets[hash];
 1181|      1|    tbuckets[hash] = tp;
 1182|      1|    lasttp = tp;
 1183|      1|    root_imports[0].label = strdup(tp->label);
 1184|      1|    root_imports[0].modid = base_modid;
 1185|       |
 1186|       |    /*
 1187|       |     * build root node 
 1188|       |     */
 1189|      1|    tp = calloc(1, sizeof(struct tree));
 1190|      1|    if (tp == NULL)
  ------------------
  |  Branch (1190:9): [True: 0, False: 1]
  ------------------
 1191|      0|        return;
 1192|      1|    tp->next_peer = lasttp;
 1193|      1|    tp->label = strdup("ccitt");
 1194|      1|    tp->modid = base_modid;
 1195|      1|    tp->number_modules = 1;
 1196|      1|    tp->module_list = &(tp->modid);
 1197|      1|    tp->subid = 0;
 1198|      1|    tp->tc_index = -1;
 1199|      1|    set_function(tp);           /* from mib.c */
 1200|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  529|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  528|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1201|      1|    tp->next = tbuckets[hash];
 1202|      1|    tbuckets[hash] = tp;
 1203|      1|    lasttp = tp;
 1204|      1|    root_imports[1].label = strdup(tp->label);
 1205|      1|    root_imports[1].modid = base_modid;
 1206|       |
 1207|       |    /*
 1208|       |     * build root node 
 1209|       |     */
 1210|      1|    tp = calloc(1, sizeof(struct tree));
 1211|      1|    if (tp == NULL)
  ------------------
  |  Branch (1211:9): [True: 0, False: 1]
  ------------------
 1212|      0|        return;
 1213|      1|    tp->next_peer = lasttp;
 1214|      1|    tp->label = strdup("iso");
 1215|      1|    tp->modid = base_modid;
 1216|      1|    tp->number_modules = 1;
 1217|      1|    tp->module_list = &(tp->modid);
 1218|      1|    tp->subid = 1;
 1219|      1|    tp->tc_index = -1;
 1220|      1|    set_function(tp);           /* from mib.c */
 1221|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  529|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  528|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1222|      1|    tp->next = tbuckets[hash];
 1223|      1|    tbuckets[hash] = tp;
 1224|      1|    lasttp = tp;
 1225|      1|    root_imports[2].label = strdup(tp->label);
 1226|      1|    root_imports[2].modid = base_modid;
 1227|       |
 1228|      1|    tree_head = tp;
 1229|      1|}
parse.c:compute_match:
 1273|    906|{
 1274|    906|#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
 1275|    906|    int             rc;
 1276|    906|    regex_t         parsetree;
 1277|    906|    regmatch_t      pmatch;
 1278|    906|    rc = regcomp(&parsetree, key, REG_ICASE | REG_EXTENDED);
 1279|    906|    if (rc == 0)
  ------------------
  |  Branch (1279:9): [True: 876, False: 30]
  ------------------
 1280|    876|        rc = regexec(&parsetree, search_base, 1, &pmatch, 0);
 1281|    906|    regfree(&parsetree);
 1282|    906|    if (rc == 0) {
  ------------------
  |  Branch (1282:9): [True: 35, False: 871]
  ------------------
 1283|       |        /*
 1284|       |         * found 
 1285|       |         */
 1286|     35|        return pmatch.rm_so;
 1287|     35|    }
 1288|       |#else                           /* use our own wildcard matcher */
 1289|       |    /*
 1290|       |     * first find the longest matching substring (ick) 
 1291|       |     */
 1292|       |    char           *first = NULL, *result = NULL, *entry;
 1293|       |    const char     *position;
 1294|       |    char           *newkey = strdup(key);
 1295|       |    char           *st;
 1296|       |
 1297|       |
 1298|       |    entry = strtok_r(newkey, "*", &st);
 1299|       |    position = search_base;
 1300|       |    while (entry) {
 1301|       |        result = strcasestr(position, entry);
 1302|       |
 1303|       |        if (result == NULL) {
 1304|       |            free(newkey);
 1305|       |            return MAX_BAD;
 1306|       |        }
 1307|       |
 1308|       |        if (first == NULL)
 1309|       |            first = result;
 1310|       |
 1311|       |        position = result + strlen(entry);
 1312|       |        entry = strtok_r(NULL, "*", &st);
 1313|       |    }
 1314|       |    free(newkey);
 1315|       |    if (result)
 1316|       |        return (first - search_base);
 1317|       |#endif
 1318|       |
 1319|       |    /*
 1320|       |     * not found 
 1321|       |     */
 1322|    871|    return MAX_BAD;
  ------------------
  |  | 1269|    871|#define MAX_BAD 0xffffff
  ------------------
 1323|    906|}
parse.c:read_module_internal:
 3909|    211|{
 3910|    211|    struct module  *mp;
 3911|    211|    FILE           *fp;
 3912|    211|    struct node    *np;
 3913|    211|    int             res;
 3914|       |
 3915|    211|    netsnmp_init_mib_internals();
 3916|       |
 3917|    211|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3917:28): [True: 0, False: 211]
  ------------------
 3918|      0|        if (!label_compare(mp->name, name)) {
  ------------------
  |  | 1234|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3918:13): [True: 0, False: 0]
  ------------------
 3919|      0|            const char     *oldFile = File;
 3920|      0|            int             oldLine = mibLine;
 3921|      0|            int             oldModule = current_module;
 3922|       |
 3923|      0|            if (mp->no_imports != -1) {
  ------------------
  |  Branch (3923:17): [True: 0, False: 0]
  ------------------
 3924|      0|                DEBUGMSGTL(("parse-mibs", "Module %s already loaded\n",
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3925|      0|                            name));
 3926|      0|                return MODULE_ALREADY_LOADED;
  ------------------
  |  |  514|      0|#define MODULE_ALREADY_LOADED	2
  ------------------
 3927|      0|            }
 3928|      0|            if ((fp = fopen(mp->file, "r")) == NULL) {
  ------------------
  |  Branch (3928:17): [True: 0, False: 0]
  ------------------
 3929|      0|                int rval;
 3930|      0|                if (errno == ENOTDIR || errno == ENOENT)
  ------------------
  |  Branch (3930:21): [True: 0, False: 0]
  |  Branch (3930:41): [True: 0, False: 0]
  ------------------
 3931|      0|                    rval = MODULE_NOT_FOUND;
  ------------------
  |  |  512|      0|#define MODULE_NOT_FOUND	0
  ------------------
 3932|      0|                else
 3933|      0|                    rval = MODULE_LOAD_FAILED;
  ------------------
  |  |  518|      0|#define MODULE_LOAD_FAILED	MODULE_NOT_FOUND
  |  |  ------------------
  |  |  |  |  512|      0|#define MODULE_NOT_FOUND	0
  |  |  ------------------
  ------------------
 3934|      0|                snmp_log_perror(mp->file);
 3935|      0|                return rval;
 3936|      0|            }
 3937|      0|#ifdef HAVE_FLOCKFILE
 3938|      0|            flockfile(fp);
 3939|      0|#endif
 3940|      0|            mp->no_imports = 0; /* Note that we've read the file */
 3941|      0|            File = mp->file;
 3942|      0|            mibLine = 1;
 3943|      0|            current_module = mp->modid;
 3944|       |            /*
 3945|       |             * Parse the file
 3946|       |             */
 3947|      0|            np = parse(fp);
 3948|      0|#ifdef HAVE_FUNLOCKFILE
 3949|      0|            funlockfile(fp);
 3950|      0|#endif
 3951|      0|            fclose(fp);
 3952|      0|            File = oldFile;
 3953|      0|            mibLine = oldLine;
 3954|      0|            current_module = oldModule;
 3955|      0|            res = !np && gMibError == MODULE_SYNTAX_ERROR ?
  ------------------
  |  |  519|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (3955:19): [True: 0, False: 0]
  |  Branch (3955:26): [True: 0, False: 0]
  ------------------
 3956|      0|                MODULE_SYNTAX_ERROR : MODULE_LOADED_OK;
  ------------------
  |  |  519|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
                              MODULE_SYNTAX_ERROR : MODULE_LOADED_OK;
  ------------------
  |  |  513|      0|#define MODULE_LOADED_OK	1
  ------------------
 3957|      0|            while (np) {
  ------------------
  |  Branch (3957:20): [True: 0, False: 0]
  ------------------
 3958|      0|                struct node *nnp = np->next;
 3959|      0|                free_node(np);
 3960|      0|                np = nnp;
 3961|      0|            }
 3962|      0|            return res;
 3963|      0|        }
 3964|       |
 3965|    211|    return MODULE_NOT_FOUND;
  ------------------
  |  |  512|    211|#define MODULE_NOT_FOUND	0
  ------------------
 3966|    211|}
parse.c:print_error:
  778|    187|{
  779|    187|    erroneousMibs++;
  780|    187|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    187|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (780:9): [True: 187, False: 0]
  ------------------
  781|    187|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|    187|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  782|    187|	return;
  783|      0|    DEBUGMSGTL(("parse-mibs", "\n"));
  ------------------
  |  |   68|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  146|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (146:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  166|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  156|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  149|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  157|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (68:70): [Folded - Ignored]
  |  |  ------------------
  ------------------
  784|      0|    if (type == ENDOFFILE)
  ------------------
  |  |  162|      0|#define ENDOFFILE   0
  ------------------
  |  Branch (784:9): [True: 0, False: 0]
  ------------------
  785|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  786|      0|                 File);
  787|      0|    else if (token && *token)
  ------------------
  |  Branch (787:14): [True: 0, False: 0]
  |  Branch (787:23): [True: 0, False: 0]
  ------------------
  788|      0|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  789|      0|                 mibLine, File);
  790|      0|    else
  791|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  792|      0|}
parse.c:read_module_replacements:
 3840|    211|{
 3841|    211|    struct module_compatability *mcp;
 3842|       |
 3843|  4.64k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (3843:33): [True: 4.44k, False: 198]
  ------------------
 3844|  4.44k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1234|  4.44k|#define	label_compare	strcmp
  ------------------
  |  Branch (3844:13): [True: 13, False: 4.43k]
  ------------------
 3845|     13|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     13|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3845:17): [True: 0, False: 13]
  ------------------
 3846|     13|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|     13|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 3847|      0|                snmp_log(LOG_WARNING,
 3848|      0|                         "Loading replacement module %s for %s (%s)\n",
 3849|      0|                         mcp->new_module, name, File);
 3850|      0|	    }
 3851|     13|            (void) netsnmp_read_module(mcp->new_module);
 3852|     13|            return 1;
 3853|     13|        }
 3854|  4.44k|    }
 3855|    198|    return 0;
 3856|    211|}
parse.c:print_module_not_found:
  796|    198|{
  797|    198|    if (first_err_module) {
  ------------------
  |  Branch (797:9): [True: 1, False: 197]
  ------------------
  798|      1|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  799|      1|                           netsnmp_get_mib_directory());
  800|      1|        first_err_module = 0;
  801|      1|    }
  802|    198|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (802:9): [True: 1, False: 197]
  |  Branch (802:29): [True: 186, False: 11]
  ------------------
  803|    187|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  161|    187|#define CONTINUE    -1
  ------------------
  804|    198|    if (last_err_module)
  ------------------
  |  Branch (804:9): [True: 197, False: 1]
  ------------------
  805|    197|        free(last_err_module);
  806|    198|    last_err_module = strdup(cp);
  807|    198|}

snmp_set_detail:
  516|    308|{
  517|    308|    if (detail_string != NULL) {
  ------------------
  |  Branch (517:9): [True: 308, False: 0]
  ------------------
  518|    308|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  519|    308|        snmp_detail_f = 1;
  520|    308|    }
  521|    308|}

snmp_get_do_debugging:
  547|    540|{
  548|    540|    return dodebug;
  549|    540|}

netsnmp_set_line_buffering:
  187|      1|{
  188|       |#if defined(WIN32)
  189|       |    /*
  190|       |     * According to MSDN, the Microsoft Visual Studio C runtime library does
  191|       |     * not support line buffering, so turn off buffering completely.
  192|       |     * See also http://msdn.microsoft.com/en-us/library/86cebhfs(VS.71).aspx.
  193|       |     */
  194|       |    setvbuf(stream, NULL, _IONBF, BUFSIZ);
  195|       |#elif defined(HAVE_SETLINEBUF)
  196|       |    /* setlinefunction() is a function from the BSD Unix API. */
  197|       |    setlinebuf(stream);
  198|       |#else
  199|       |    /* See also the C89 or C99 standard for more information about setvbuf(). */
  200|      1|    setvbuf(stream, NULL, _IOLBF, BUFSIZ);
  201|      1|#endif
  202|      1|}
log_handler_stdouterr:
 1093|      1|{
 1094|      1|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1095|      1|    const char     *newline_ptr;
 1096|      1|    char            sbuf[40];
 1097|       |
 1098|      1|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      1|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1098:9): [True: 0, False: 1]
  ------------------
 1099|      1|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|      1|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1099:65): [True: 0, False: 0]
  ------------------
 1100|      0|        sprintf_stamp(NULL, sbuf);
 1101|      1|    } else {
 1102|      1|        strcpy(sbuf, "");
 1103|      1|    }
 1104|       |    /*
 1105|       |     * Remember whether or not the current line ends with a newline for the
 1106|       |     * next call of log_handler_stdouterr().
 1107|       |     */
 1108|      1|    newline_ptr = strrchr(str, '\n');
 1109|      1|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1109:15): [True: 1, False: 0]
  |  Branch (1109:30): [True: 1, False: 0]
  ------------------
 1110|       |
 1111|      1|    if (logh->imagic)
  ------------------
  |  Branch (1111:9): [True: 0, False: 1]
  ------------------
 1112|      0|       printf(         "%s%s", sbuf, str);
 1113|      1|    else
 1114|      1|       fprintf(stderr, "%s%s", sbuf, str);
 1115|       |
 1116|      1|    return 1;
 1117|      1|}
snmp_log_string:
 1284|      1|{
 1285|      1|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1286|      1|    static int stderr_enabled = 0;
 1287|      1|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1288|      1|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1289|      1|                                      NULL };
 1290|      1|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1291|      1|    netsnmp_log_handler *logh;
 1292|       |
 1293|       |    /*
 1294|       |     * We've got to be able to log messages *somewhere*!
 1295|       |     * If you don't want stderr logging, then enable something else.
 1296|       |     */
 1297|      1|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1297:9): [True: 1, False: 0]
  ------------------
 1298|      1|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1299|      1|        if (!stderr_enabled) {
  ------------------
  |  Branch (1299:13): [True: 1, False: 0]
  ------------------
 1300|      1|            ++stderr_enabled;
 1301|      1|            netsnmp_set_line_buffering(stderr);
 1302|      1|        }
 1303|      1|        log_handler_stdouterr( &lh, priority, str );
 1304|      1|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1305|       |
 1306|      1|        return;
 1307|      1|    }
 1308|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1309|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1309:14): [True: 0, False: 0]
  ------------------
 1310|      0|        stderr_enabled = 0;
 1311|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1312|      0|                               "Log handling defined - disabling stderr\n" );
 1313|      0|    }
 1314|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1315|       |        
 1316|       |
 1317|       |    /*
 1318|       |     * Start at the given priority, and work "upwards"....
 1319|       |     */
 1320|      0|    if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1320:9): [True: 0, False: 0]
  ------------------
 1321|      0|        priority = LOG_DEBUG;
 1322|      0|    logh = logh_priorities[priority];
 1323|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1323:13): [True: 0, False: 0]
  ------------------
 1324|       |        /*
 1325|       |         * ... but skipping any handlers with a "maximum priority"
 1326|       |         *     that we have already exceeded. And don't forget to
 1327|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1328|       |         *     and its cohorts).
 1329|       |         */
 1330|      0|        if (logh->enabled && priority <= logh->pri_max)
  ------------------
  |  Branch (1330:13): [True: 0, False: 0]
  |  Branch (1330:30): [True: 0, False: 0]
  ------------------
 1331|      0|            logh->handler( logh, priority, str );
 1332|      0|    }
 1333|      0|}
snmp_vlog:
 1371|      1|{
 1372|      1|    char           *buffer = NULL;
 1373|      1|    int             length;
 1374|       |
 1375|      1|    length = vasprintf(&buffer, format, ap);
 1376|      1|    if (length < 0) {
  ------------------
  |  Branch (1376:9): [True: 0, False: 1]
  ------------------
 1377|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1378|      0|        return -1;
 1379|      0|    }
 1380|       |
 1381|      1|    snmp_log_string(priority, buffer);
 1382|      1|    free(buffer);
 1383|      1|    return 0;
 1384|      1|}
snmp_log:
 1395|      1|{
 1396|      1|    va_list         ap;
 1397|      1|    int             ret;
 1398|      1|    va_start(ap, format);
 1399|      1|    ret = snmp_vlog(priority, format, ap);
 1400|      1|    va_end(ap);
 1401|      1|    return (ret);
 1402|      1|}

strlcpy:
   26|    308|{ 
   27|    308|	size_t src_len = strlen(src); 
   28|    308|	size_t new_len; 
   29|       |
   30|    308|	if (len == 0) {
  ------------------
  |  Branch (30:6): [True: 0, False: 308]
  ------------------
   31|      0|		return (src_len);
   32|      0|	}
   33|       |
   34|    308|        if (src_len >= len) {
  ------------------
  |  Branch (34:13): [True: 8, False: 300]
  ------------------
   35|      8|		new_len = len - 1;
   36|    300|	} else {
   37|    300|                new_len = src_len;
   38|    300|	}
   39|       |
   40|    308|        memcpy(dest, src, new_len); 
   41|    308|	dest[new_len] = '\0'; 
   42|    308|	return (src_len); 
   43|    308|}

netsnmp_getenv:
 1189|      1|{
 1190|      1|#if !defined (WIN32) && !defined (cygwin)
 1191|      1|  return (getenv(name));
 1192|       |#else
 1193|       |  char *temp = NULL;  
 1194|       |  HKEY hKey;
 1195|       |  unsigned char * key_value = NULL;
 1196|       |  DWORD key_value_size = 0;
 1197|       |  DWORD key_value_type = 0;
 1198|       |  DWORD getenv_worked = 0;
 1199|       |
 1200|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv called with name: %s\n",name));
 1201|       |
 1202|       |  if (!(name))
 1203|       |    return NULL;
 1204|       |  
 1205|       |  /* Try environment variable first */ 
 1206|       |  temp = getenv(name);
 1207|       |  if (temp) {
 1208|       |    getenv_worked = 1;
 1209|       |    DEBUGMSGTL(("read_config", "netsnmp_getenv will return from ENV: %s\n",temp));
 1210|       |  }
 1211|       |  
 1212|       |  /* Next try HKCU */
 1213|       |  if (temp == NULL)
 1214|       |  {
 1215|       |    if (getenv("SNMP_IGNORE_WINDOWS_REGISTRY"))
 1216|       |      return NULL;
 1217|       |
 1218|       |    if (RegOpenKeyExA(
 1219|       |          HKEY_CURRENT_USER, 
 1220|       |          "SOFTWARE\\Net-SNMP", 
 1221|       |          0, 
 1222|       |          KEY_QUERY_VALUE, 
 1223|       |          &hKey) == ERROR_SUCCESS) {   
 1224|       |      
 1225|       |      if (RegQueryValueExA(
 1226|       |            hKey, 
 1227|       |            name, 
 1228|       |            NULL, 
 1229|       |            &key_value_type, 
 1230|       |            NULL,               /* Just get the size */
 1231|       |            &key_value_size) == ERROR_SUCCESS) {
 1232|       |
 1233|       |        SNMP_FREE(key_value);
 1234|       |
 1235|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1236|       |         * string data in registry is missing one (which is unlikely).
 1237|       |         */
 1238|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1239|       |        
 1240|       |        if (RegQueryValueExA(
 1241|       |              hKey, 
 1242|       |              name, 
 1243|       |              NULL, 
 1244|       |              &key_value_type, 
 1245|       |              key_value, 
 1246|       |              &key_value_size) == ERROR_SUCCESS) {
 1247|       |        }
 1248|       |        temp = (char *) key_value;
 1249|       |      }
 1250|       |      RegCloseKey(hKey);
 1251|       |      if (temp)
 1252|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKCU: %s\n",temp));
 1253|       |    }
 1254|       |  }
 1255|       |
 1256|       |  /* Next try HKLM */
 1257|       |  if (temp == NULL)
 1258|       |  {
 1259|       |    if (RegOpenKeyExA(
 1260|       |          HKEY_LOCAL_MACHINE, 
 1261|       |          "SOFTWARE\\Net-SNMP", 
 1262|       |          0, 
 1263|       |          KEY_QUERY_VALUE, 
 1264|       |          &hKey) == ERROR_SUCCESS) {   
 1265|       |      
 1266|       |      if (RegQueryValueExA(
 1267|       |            hKey, 
 1268|       |            name, 
 1269|       |            NULL, 
 1270|       |            &key_value_type, 
 1271|       |            NULL,               /* Just get the size */
 1272|       |            &key_value_size) == ERROR_SUCCESS) {
 1273|       |
 1274|       |        SNMP_FREE(key_value);
 1275|       |
 1276|       |        /* Allocate memory needed +1 to allow RegQueryValueExA to NULL terminate the
 1277|       |         * string data in registry is missing one (which is unlikely).
 1278|       |         */
 1279|       |        key_value = malloc((sizeof(char) * key_value_size)+sizeof(char));
 1280|       |        
 1281|       |        if (RegQueryValueExA(
 1282|       |              hKey, 
 1283|       |              name, 
 1284|       |              NULL, 
 1285|       |              &key_value_type, 
 1286|       |              key_value, 
 1287|       |              &key_value_size) == ERROR_SUCCESS) {
 1288|       |        }
 1289|       |        temp = (char *) key_value;
 1290|       |
 1291|       |      }
 1292|       |      RegCloseKey(hKey);
 1293|       |      if (temp)
 1294|       |        DEBUGMSGTL(("read_config", "netsnmp_getenv will return from HKLM: %s\n",temp));
 1295|       |    }
 1296|       |  }
 1297|       |  
 1298|       |  if (temp && !getenv_worked) {
 1299|       |    setenv(name, temp, 1);
 1300|       |    SNMP_FREE(temp);
 1301|       |  }
 1302|       |
 1303|       |  DEBUGMSGTL(("read_config", "netsnmp_getenv returning: %s\n",getenv(name)));
 1304|       |
 1305|       |  return(getenv(name));
 1306|       |#endif
 1307|      1|}

LLVMFuzzerInitialize:
   36|      2|int LLVMFuzzerInitialize(int *argc, char ***argv) {
   37|      2|    if (getenv("NETSNMP_DEBUGGING") != NULL) {
  ------------------
  |  Branch (37:9): [True: 0, False: 2]
  ------------------
   38|       |        /*
   39|       |         * Turn on all debugging, to help understand what
   40|       |         * bits of the parser are running.
   41|       |         */
   42|      0|        snmp_enable_stderrlog();
   43|      0|        snmp_set_do_debugging(1);
   44|      0|        debug_register_tokens("");
   45|      0|    }
   46|      2|    return 0;
   47|      2|}
LLVMFuzzerTestOneInput:
   53|    611|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   54|    611|    oid *root = malloc(MAX_OID_LEN * sizeof(oid));
  ------------------
  |  |  103|    611|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
   55|    611|    size_t rootlen = MAX_OID_LEN;
  ------------------
  |  |  103|    611|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
   56|    611|    char *input;
   57|       |
   58|    611|    input = strndup((const char *)data, size);
   59|    611|    if (root && input)
  ------------------
  |  Branch (59:9): [True: 611, False: 0]
  |  Branch (59:17): [True: 611, False: 0]
  ------------------
   60|    611|        snmp_parse_oid((const char *)input, root, &rootlen);
   61|    611|    free(root);
   62|    611|    free(input);
   63|    611|    return 0; 
   64|    611|}

