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

netsnmp_set_mib_directory:
 2566|      2|{
 2567|      2|    const char *newdir;
 2568|      2|    char *olddir, *tmpdir = NULL;
 2569|       |
 2570|      2|    DEBUGTRACE;
  ------------------
  |  |   63|      2|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2571|      2|    if (NULL == dir) {
  ------------------
  |  Branch (2571:9): [True: 0, False: 2]
  ------------------
 2572|      0|        return;
 2573|      0|    }
 2574|       |    
 2575|      2|    olddir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|      2|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 2576|      2|				   NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      2|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2577|      2|    if (olddir) {
  ------------------
  |  Branch (2577:9): [True: 2, False: 0]
  ------------------
 2578|      2|        if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2578:13): [True: 0, False: 2]
  |  Branch (2578:30): [True: 0, False: 2]
  ------------------
 2579|       |            /** New dir starts with '+', thus we add it. */
 2580|      0|            if (*dir++ == '+') {
  ------------------
  |  Branch (2580:17): [True: 0, False: 0]
  ------------------
 2581|      0|                if (asprintf(&tmpdir, "%s%c%s", olddir, ENV_SEPARATOR_CHAR, dir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2581:21): [True: 0, False: 0]
  ------------------
 2582|      0|                    tmpdir = NULL;
 2583|      0|            } else {
 2584|      0|                if (asprintf(&tmpdir, "%s%c%s", dir, ENV_SEPARATOR_CHAR, olddir) < 0)
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
  |  Branch (2584:21): [True: 0, False: 0]
  ------------------
 2585|      0|                    tmpdir = NULL;
 2586|      0|            }
 2587|      0|            if (!tmpdir) {
  ------------------
  |  Branch (2587:17): [True: 0, False: 0]
  ------------------
 2588|      0|                DEBUGMSGTL(("read_config:initmib", "set mibdir malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2589|      0|                return;
 2590|      0|            }
 2591|      0|            newdir = tmpdir;
 2592|      2|        } else {
 2593|      2|            newdir = dir;
 2594|      2|        }
 2595|      2|    } else {
 2596|       |        /** If dir starts with '+' skip '+' it. */
 2597|      0|        newdir = ((*dir == '+') ? ++dir : dir);
  ------------------
  |  Branch (2597:19): [True: 0, False: 0]
  ------------------
 2598|      0|    }
 2599|      2|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|      2|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|      2|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2600|      2|                          newdir);
 2601|       |
 2602|       |    /** set_string calls strdup, so if we allocated memory, free it */
 2603|      2|    if (tmpdir == newdir) {
  ------------------
  |  Branch (2603:9): [True: 0, False: 2]
  ------------------
 2604|       |        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, False: 0]
  |  |  ------------------
  ------------------
 2605|      0|    }
 2606|      2|}
netsnmp_get_mib_directory:
 2623|      6|{
 2624|      6|    char *dir;
 2625|       |
 2626|      6|    DEBUGTRACE;
  ------------------
  |  |   63|      6|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2627|      6|    dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      6|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      6|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2628|      6|    if (dir == NULL) {
  ------------------
  |  Branch (2628:9): [True: 0, False: 6]
  ------------------
 2629|      0|        DEBUGMSGTL(("get_mib_directory", "no mib directories set\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2630|       |
 2631|       |        /** Check if the environment variable is set */
 2632|      0|        dir = netsnmp_getenv("MIBDIRS");
 2633|      0|        if (dir == NULL) {
  ------------------
  |  Branch (2633:13): [True: 0, False: 0]
  ------------------
 2634|      0|            DEBUGMSGTL(("get_mib_directory", "no mib directories set by environment\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2635|       |            /** Not set use hard coded path */
 2636|      0|            if (confmibdir == NULL) {
  ------------------
  |  Branch (2636:17): [True: 0, False: 0]
  ------------------
 2637|      0|                DEBUGMSGTL(("get_mib_directory", "no mib directories set by config\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2638|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2639|      0|            }
 2640|      0|            else if ((*confmibdir == '+') || (*confmibdir == '-')) {
  ------------------
  |  Branch (2640:22): [True: 0, False: 0]
  |  Branch (2640:46): [True: 0, False: 0]
  ------------------
 2641|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2642|      0|                netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2643|      0|                netsnmp_set_mib_directory(confmibdir);
 2644|      0|            }
 2645|      0|            else {
 2646|      0|                DEBUGMSGTL(("get_mib_directory", "mib directories set by config\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2647|      0|                netsnmp_set_mib_directory(confmibdir);
 2648|      0|            }
 2649|      0|        } else if ((*dir == '+') || (*dir == '-')) {
  ------------------
  |  Branch (2649:20): [True: 0, False: 0]
  |  Branch (2649:37): [True: 0, False: 0]
  ------------------
 2650|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment (but added)\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2651|      0|            netsnmp_set_mib_directory(NETSNMP_DEFAULT_MIBDIRS);
  ------------------
  |  | 1675|      0|#define NETSNMP_DEFAULT_MIBDIRS "$HOME/.snmp/mibs:/usr/local/net-snmp-master/share/snmp/mibs"
  ------------------
 2652|      0|            netsnmp_set_mib_directory(dir);
 2653|      0|        } else {
 2654|      0|            DEBUGMSGTL(("get_mib_directory", "mib directories set by environment\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2655|      0|            netsnmp_set_mib_directory(dir);
 2656|      0|        }
 2657|      0|        dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |   48|      0|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      dir = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS);
  ------------------
  |  |  162|      0|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
 2658|      0|    }
 2659|      6|    DEBUGMSGTL(("get_mib_directory", "mib directories set '%s'\n", dir));
  ------------------
  |  |   66|      6|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      6|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 6]
  |  |  ------------------
  ------------------
 2660|      6|    return(dir);
 2661|      6|}
netsnmp_fixup_mib_directory:
 2670|      2|{
 2671|      2|    const char *homepath = netsnmp_gethomedir();
 2672|      2|    char *mibpath = netsnmp_get_mib_directory();
 2673|      2|    char *oldmibpath = NULL;
 2674|      2|    char *ptr_home;
 2675|      2|    char *new_mibpath;
 2676|      2|    size_t new_mibpath_len;
 2677|       |
 2678|      2|    DEBUGTRACE;
  ------------------
  |  |   63|      2|#define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGTRACE         do {if (_DBG_IF_) {__DBGTRACE;} }while(0)
  |  |  ------------------
  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  ------------------
  |  |  |  Branch (63:67): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2679|      2|    if (homepath && mibpath) {
  ------------------
  |  Branch (2679:9): [True: 2, False: 0]
  |  Branch (2679:21): [True: 2, False: 0]
  ------------------
 2680|      2|        DEBUGMSGTL(("fixup_mib_directory", "mib directories '%s'\n", mibpath));
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2681|      2|        while ((ptr_home = strstr(mibpath, "$HOME"))) {
  ------------------
  |  Branch (2681:16): [True: 0, False: 2]
  ------------------
 2682|      0|            new_mibpath_len = strlen(mibpath) - strlen("$HOME") +
 2683|      0|					 strlen(homepath)+1;
 2684|      0|            new_mibpath = (char *)malloc(new_mibpath_len);
 2685|      0|            if (new_mibpath) {
  ------------------
  |  Branch (2685:17): [True: 0, False: 0]
  ------------------
 2686|      0|                *ptr_home = 0; /* null out the spot where we stop copying */
 2687|      0|                snprintf(new_mibpath, new_mibpath_len, "%s%s%s", mibpath, homepath,
 2688|      0|			ptr_home + strlen("$HOME"));
 2689|       |                /** swap in the new value and repeat */
 2690|      0|                mibpath = new_mibpath;
 2691|      0|		if (oldmibpath != NULL) {
  ------------------
  |  Branch (2691:7): [True: 0, False: 0]
  ------------------
 2692|      0|		    SNMP_FREE(oldmibpath);
  ------------------
  |  |   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, False: 0]
  |  |  ------------------
  ------------------
 2693|      0|		}
 2694|      0|		oldmibpath = new_mibpath;
 2695|      0|            } else {
 2696|      0|                break;
 2697|      0|            }
 2698|      0|        }
 2699|       |
 2700|      2|        netsnmp_set_mib_directory(mibpath);
 2701|       |	
 2702|       |	/*  The above copies the mibpath for us, so...  */
 2703|       |
 2704|      2|	if (oldmibpath != NULL) {
  ------------------
  |  Branch (2704:6): [True: 0, False: 2]
  ------------------
 2705|      0|	    SNMP_FREE(oldmibpath);
  ------------------
  |  |   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, False: 0]
  |  |  ------------------
  ------------------
 2706|      0|	}
 2707|       |
 2708|      2|    }
 2709|       |
 2710|      2|}
netsnmp_init_mib:
 2719|      2|{
 2720|      2|    const char     *prefix;
 2721|      2|    char           *env_var, *entry;
 2722|      2|    PrefixListPtr   pp = &mib_prefixes[0];
 2723|      2|    char           *st = NULL;
 2724|       |
 2725|      2|    if (Mib)
  ------------------
  |  Branch (2725:9): [True: 0, False: 2]
  ------------------
 2726|      0|        return;
 2727|      2|    netsnmp_init_mib_internals();
 2728|       |
 2729|       |    /*
 2730|       |     * Initialise the MIB directory/ies 
 2731|       |     */
 2732|      2|    netsnmp_fixup_mib_directory();
 2733|      2|    env_var = strdup(netsnmp_get_mib_directory());
 2734|      2|    if (!env_var)
  ------------------
  |  Branch (2734:9): [True: 0, False: 2]
  ------------------
 2735|      0|        return;
 2736|       |
 2737|      2|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2738|      2|                "Seen MIBDIRS: Looking in '%s' for mib dirs ...\n",
 2739|      2|                env_var));
 2740|       |
 2741|      2|    entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      2|#define ENV_SEPARATOR ":"
  ------------------
 2742|      4|    while (entry) {
  ------------------
  |  Branch (2742:12): [True: 2, False: 2]
  ------------------
 2743|      2|        add_mibdir(entry);
 2744|      2|        entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      2|#define ENV_SEPARATOR ":"
  ------------------
 2745|      2|    }
 2746|      2|    SNMP_FREE(env_var);
  ------------------
  |  |   62|      2|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 2, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2747|       |
 2748|      2|    env_var = netsnmp_getenv("MIBFILES");
 2749|      2|    if (env_var != NULL) {
  ------------------
  |  Branch (2749:9): [True: 0, False: 2]
  ------------------
 2750|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2750:13): [True: 0, False: 0]
  ------------------
 2751|      0|            entry = strtok_r(env_var+1, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2752|      0|        else
 2753|      0|            entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2754|      0|        while (entry) {
  ------------------
  |  Branch (2754:16): [True: 0, False: 0]
  ------------------
 2755|      0|            add_mibfile(entry, NULL);
 2756|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2757|      0|        }
 2758|      0|    }
 2759|       |
 2760|      2|    netsnmp_init_mib_internals();
 2761|       |
 2762|       |    /*
 2763|       |     * Read in any modules or mibs requested 
 2764|       |     */
 2765|       |
 2766|      2|    env_var = netsnmp_getenv("MIBS");
 2767|      2|    if (env_var == NULL) {
  ------------------
  |  Branch (2767:9): [True: 2, False: 0]
  ------------------
 2768|      2|        if (confmibs != NULL)
  ------------------
  |  Branch (2768:13): [True: 0, False: 2]
  ------------------
 2769|      0|            env_var = strdup(confmibs);
 2770|      2|        else
 2771|      2|            env_var = strdup(NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 2023|      2|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:LM-SENSORS-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2772|      2|    } else {
 2773|      0|        env_var = strdup(env_var);
 2774|      0|    }
 2775|      2|    if (env_var && ((*env_var == '+') || (*env_var == '-'))) {
  ------------------
  |  Branch (2775:9): [True: 2, False: 0]
  |  Branch (2775:21): [True: 0, False: 2]
  |  Branch (2775:42): [True: 0, False: 2]
  ------------------
 2776|      0|        int res;
 2777|       |
 2778|      0|        if (*env_var == '+')
  ------------------
  |  Branch (2778:13): [True: 0, False: 0]
  ------------------
 2779|      0|            res = asprintf(&entry, "%s%c%s", NETSNMP_DEFAULT_MIBS,
  ------------------
  |  | 2023|      0|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:LM-SENSORS-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2780|      0|                           ENV_SEPARATOR_CHAR, env_var + 1);
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2781|      0|        else
 2782|      0|            res = asprintf(&entry, "%s%c%s", env_var + 1, ENV_SEPARATOR_CHAR,
  ------------------
  |  |   70|      0|#define ENV_SEPARATOR_CHAR ':'
  ------------------
 2783|      0|                           NETSNMP_DEFAULT_MIBS);
  ------------------
  |  | 2023|      0|#define NETSNMP_DEFAULT_MIBS ":NET-SNMP-EXTEND-MIB:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:HOST-RESOURCES-MIB:NOTIFICATION-LOG-MIB:DISMAN-EVENT-MIB:DISMAN-SCHEDULE-MIB:NET-SNMP-PERIODIC-NOTIFY-MIB:DISMAN-NSLOOKUP-MIB:DISMAN-PING-MIB:DISMAN-TRACEROUTE-MIB:EtherLike-MIB:NET-SNMP-EXAMPLES-MIB:HOST-RESOURCES-TYPES:IP-FORWARD-MIB:MTA-MIB:NETWORK-SERVICES-MIB:UCD-IPFWACC-MIB:RMON-MIB:SCTP-MIB:SNMP-USM-DH-OBJECTS-MIB:SNMP-TLS-TM-MIB:SNMP-TSM-MIB:TUNNEL-MIB:IPV6-FLOW-LABEL-MIB:UCD-DISKIO-MIB:LM-SENSORS-MIB:UCD-SNMP-MIB:UCD-DEMO-MIB:SNMP-TARGET-MIB:NET-SNMP-AGENT-MIB:SNMP-NOTIFICATION-MIB:NET-SNMP-PASS-MIB:SNMP-FRAMEWORK-MIB:SNMP-MPD-MIB:SNMP-USER-BASED-SM-MIB:SNMP-VIEW-BASED-ACM-MIB:SNMP-COMMUNITY-MIB:IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB:UCD-DLMOD-MIB:SNMPv2-TM:NET-SNMP-VACM-MIB"
  ------------------
 2784|      0|        SNMP_FREE(env_var);
  ------------------
  |  |   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, False: 0]
  |  |  ------------------
  ------------------
 2785|      0|        if (res < 0) {
  ------------------
  |  Branch (2785:13): [True: 0, False: 0]
  ------------------
 2786|      0|            DEBUGMSGTL(("init_mib", "env mibs malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2787|      0|            return;
 2788|      0|        }
 2789|      0|        env_var = entry;
 2790|      0|    }
 2791|       |
 2792|      2|    if (env_var != NULL) {
  ------------------
  |  Branch (2792:9): [True: 2, False: 0]
  ------------------
 2793|      2|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2794|      2|                    "Seen MIBS: Looking in '%s' for mib files ...\n",
 2795|      2|                    env_var));
 2796|      2|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      2|#define ENV_SEPARATOR ":"
  ------------------
 2797|     98|        while (entry) {
  ------------------
  |  Branch (2797:16): [True: 96, False: 2]
  ------------------
 2798|     96|            if (strcasecmp(entry, DEBUG_ALWAYS_TOKEN) == 0) {
  ------------------
  |  |  227|     96|#define DEBUG_ALWAYS_TOKEN "all"
  ------------------
  |  Branch (2798:17): [True: 0, False: 96]
  ------------------
 2799|      0|                read_all_mibs();
 2800|     96|            } else if (strstr(entry, "/") != NULL) {
  ------------------
  |  Branch (2800:24): [True: 0, False: 96]
  ------------------
 2801|      0|                read_mib(entry);
 2802|     96|            } else {
 2803|     96|                netsnmp_read_module(entry);
 2804|     96|            }
 2805|     96|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|     96|#define ENV_SEPARATOR ":"
  ------------------
 2806|     96|        }
 2807|      2|        adopt_orphans();
 2808|      2|        SNMP_FREE(env_var);
  ------------------
  |  |   62|      2|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 2, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2809|      2|    }
 2810|       |
 2811|      2|    env_var = netsnmp_getenv("MIBFILES");
 2812|      2|    if (env_var != NULL) {
  ------------------
  |  Branch (2812:9): [True: 0, False: 2]
  ------------------
 2813|      0|        if ((*env_var == '+') || (*env_var == '-')) {
  ------------------
  |  Branch (2813:13): [True: 0, False: 0]
  |  Branch (2813:34): [True: 0, False: 0]
  ------------------
 2814|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2815|       |            int res;
 2816|       |
 2817|       |            if (*env_var++ == '+')
 2818|       |                res = asprintf(&entry, "%s%c%s", NETSNMP_DEFAULT_MIBFILES,
 2819|       |                               ENV_SEPARATOR_CHAR, env_var);
 2820|       |            else
 2821|       |                res = asprintf(&entry, "%s%c%s", env_var,
 2822|       |                               ENV_SEPARATOR_CHAR, NETSNMP_DEFAULT_MIBFILES);
 2823|       |            if (res >= 0)
 2824|       |                env_var = entry;
 2825|       |            else
 2826|       |                DEBUGMSGTL(("init_mib", "env mibfiles malloc failed"));
 2827|       |#else
 2828|      0|            env_var = strdup(env_var + 1);
 2829|      0|#endif
 2830|      0|        } else {
 2831|      0|            env_var = strdup(env_var);
 2832|      0|        }
 2833|      2|    } else {
 2834|       |#ifdef NETSNMP_DEFAULT_MIBFILES
 2835|       |        env_var = strdup(NETSNMP_DEFAULT_MIBFILES);
 2836|       |#endif
 2837|      2|    }
 2838|       |
 2839|      2|    if (env_var != NULL) {
  ------------------
  |  Branch (2839:9): [True: 0, False: 2]
  ------------------
 2840|      0|        DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2841|      0|                    "Seen MIBFILES: Looking in '%s' for mib files ...\n",
 2842|      0|                    env_var));
 2843|      0|        entry = strtok_r(env_var, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2844|      0|        while (entry) {
  ------------------
  |  Branch (2844:16): [True: 0, False: 0]
  ------------------
 2845|      0|            read_mib(entry);
 2846|      0|            entry = strtok_r(NULL, ENV_SEPARATOR, &st);
  ------------------
  |  |   67|      0|#define ENV_SEPARATOR ":"
  ------------------
 2847|      0|        }
 2848|      0|        SNMP_FREE(env_var);
  ------------------
  |  |   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, False: 0]
  |  |  ------------------
  ------------------
 2849|      0|    }
 2850|       |
 2851|      2|    prefix = netsnmp_getenv("PREFIX");
 2852|       |
 2853|      2|    if (!prefix)
  ------------------
  |  Branch (2853:9): [True: 2, False: 0]
  ------------------
 2854|      2|        prefix = Standard_Prefix;
 2855|       |
 2856|      2|    Prefix = (char *) malloc(strlen(prefix) + 2);
 2857|      2|    if (!Prefix)
  ------------------
  |  Branch (2857:9): [True: 0, False: 2]
  ------------------
 2858|      0|        DEBUGMSGTL(("init_mib", "Prefix malloc failed"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 2859|      2|    else
 2860|      2|        strcpy(Prefix, prefix);
 2861|       |
 2862|      2|    DEBUGMSGTL(("init_mib",
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
 2863|      2|                "Seen PREFIX: Looking in '%s' for prefix ...\n", Prefix));
 2864|       |
 2865|       |    /*
 2866|       |     * remove trailing dot 
 2867|       |     */
 2868|      2|    if (Prefix) {
  ------------------
  |  Branch (2868:9): [True: 2, False: 0]
  ------------------
 2869|      2|        env_var = &Prefix[strlen(Prefix) - 1];
 2870|      2|        if (*env_var == '.')
  ------------------
  |  Branch (2870:13): [True: 0, False: 2]
  ------------------
 2871|      0|            *env_var = '\0';
 2872|      2|    }
 2873|       |
 2874|      2|    pp->str = Prefix;           /* fixup first mib_prefix entry */
 2875|       |    /*
 2876|       |     * now that the list of prefixes is built, save each string length. 
 2877|       |     */
 2878|     14|    while (pp->str) {
  ------------------
  |  Branch (2878:12): [True: 12, False: 2]
  ------------------
 2879|     12|        pp->len = strlen(pp->str);
 2880|     12|        pp++;
 2881|     12|    }
 2882|       |
 2883|      2|    Mib = tree_head;            /* Backwards compatibility */
 2884|      2|    tree_top = calloc(1, sizeof(struct tree));
 2885|       |    /*
 2886|       |     * XX error check ? 
 2887|       |     */
 2888|      2|    if (tree_top) {
  ------------------
  |  Branch (2888:9): [True: 2, False: 0]
  ------------------
 2889|      2|        tree_top->label = strdup("(top)");
 2890|      2|        tree_top->child_list = tree_head;
 2891|      2|    }
 2892|      2|}
set_function:
 2955|      6|{
 2956|      6|    subtree->printer = NULL;
 2957|      6|    switch (subtree->type) {
 2958|      0|    case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (2958:5): [True: 0, False: 6]
  ------------------
 2959|      0|        subtree->printomat = sprint_realloc_object_identifier;
 2960|      0|        break;
 2961|      0|    case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (2961:5): [True: 0, False: 6]
  ------------------
 2962|      0|        subtree->printomat = sprint_realloc_octet_string;
 2963|      0|        break;
 2964|      0|    case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (2964:5): [True: 0, False: 6]
  ------------------
 2965|      0|        subtree->printomat = sprint_realloc_integer;
 2966|      0|        break;
 2967|      0|    case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (2967:5): [True: 0, False: 6]
  ------------------
 2968|      0|        subtree->printomat = sprint_realloc_integer;
 2969|      0|        break;
 2970|      0|    case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (2970:5): [True: 0, False: 6]
  ------------------
 2971|      0|        subtree->printomat = sprint_realloc_networkaddress;
 2972|      0|        break;
 2973|      0|    case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (2973:5): [True: 0, False: 6]
  ------------------
 2974|      0|        subtree->printomat = sprint_realloc_ipaddress;
 2975|      0|        break;
 2976|      0|    case TYPE_COUNTER:
  ------------------
  |  |  160|      0|#define TYPE_COUNTER        6
  ------------------
  |  Branch (2976:5): [True: 0, False: 6]
  ------------------
 2977|      0|        subtree->printomat = sprint_realloc_counter;
 2978|      0|        break;
 2979|      0|    case TYPE_GAUGE:
  ------------------
  |  |  161|      0|#define TYPE_GAUGE          7
  ------------------
  |  Branch (2979:5): [True: 0, False: 6]
  ------------------
 2980|      0|        subtree->printomat = sprint_realloc_gauge;
 2981|      0|        break;
 2982|      0|    case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (2982:5): [True: 0, False: 6]
  ------------------
 2983|      0|        subtree->printomat = sprint_realloc_timeticks;
 2984|      0|        break;
 2985|      0|    case TYPE_OPAQUE:
  ------------------
  |  |  163|      0|#define TYPE_OPAQUE         9
  ------------------
  |  Branch (2985:5): [True: 0, False: 6]
  ------------------
 2986|      0|        subtree->printomat = sprint_realloc_opaque;
 2987|      0|        break;
 2988|      0|    case TYPE_NULL:
  ------------------
  |  |  164|      0|#define TYPE_NULL           10
  ------------------
  |  Branch (2988:5): [True: 0, False: 6]
  ------------------
 2989|      0|        subtree->printomat = sprint_realloc_null;
 2990|      0|        break;
 2991|      0|    case TYPE_BITSTRING:
  ------------------
  |  |  166|      0|#define TYPE_BITSTRING      12
  ------------------
  |  Branch (2991:5): [True: 0, False: 6]
  ------------------
 2992|      0|        subtree->printomat = sprint_realloc_bitstring;
 2993|      0|        break;
 2994|      0|    case TYPE_NSAPADDRESS:
  ------------------
  |  |  167|      0|#define TYPE_NSAPADDRESS    13
  ------------------
  |  Branch (2994:5): [True: 0, False: 6]
  ------------------
 2995|      0|        subtree->printomat = sprint_realloc_nsapaddress;
 2996|      0|        break;
 2997|      0|    case TYPE_COUNTER64:
  ------------------
  |  |  165|      0|#define TYPE_COUNTER64      11
  ------------------
  |  Branch (2997:5): [True: 0, False: 6]
  ------------------
 2998|      0|        subtree->printomat = sprint_realloc_counter64;
 2999|      0|        break;
 3000|      0|    case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (3000:5): [True: 0, False: 6]
  ------------------
 3001|      0|        subtree->printomat = sprint_realloc_uinteger;
 3002|      0|        break;
 3003|      0|    case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (3003:5): [True: 0, False: 6]
  ------------------
 3004|      0|        subtree->printomat = sprint_realloc_gauge;
 3005|      0|        break;
 3006|      6|    case TYPE_OTHER:
  ------------------
  |  |  154|      6|#define TYPE_OTHER          0
  ------------------
  |  Branch (3006:5): [True: 6, False: 0]
  ------------------
 3007|      6|    default:
  ------------------
  |  Branch (3007:5): [True: 0, False: 6]
  ------------------
 3008|      6|        subtree->printomat = sprint_realloc_by_type;
 3009|      6|        break;
 3010|      6|    }
 3011|      6|}
read_objid:
 3032|    872|{
 3033|    872|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3034|    872|    struct tree    *root = tree_top;
 3035|    872|    char            buf[SPRINT_MAX_LEN];
 3036|    872|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3037|    872|    int             ret, max_out_len;
 3038|    872|    char           *name, ch;
 3039|    872|    const char     *cp;
 3040|       |
 3041|    872|    cp = input;
 3042|  5.76k|    while ((ch = *cp)) {
  ------------------
  |  Branch (3042:12): [True: 5.54k, False: 219]
  ------------------
 3043|  5.54k|        if (('0' <= ch && ch <= '9')
  ------------------
  |  Branch (3043:14): [True: 4.66k, False: 884]
  |  Branch (3043:27): [True: 615, False: 4.04k]
  ------------------
 3044|  4.93k|            || ('a' <= ch && ch <= 'z')
  ------------------
  |  Branch (3044:17): [True: 2.84k, False: 2.09k]
  |  Branch (3044:30): [True: 2.82k, False: 17]
  ------------------
 3045|  2.10k|            || ('A' <= ch && ch <= 'Z')
  ------------------
  |  Branch (3045:17): [True: 1.20k, False: 898]
  |  Branch (3045:30): [True: 1.02k, False: 188]
  ------------------
 3046|  1.08k|            || ch == '-')
  ------------------
  |  Branch (3046:16): [True: 433, False: 653]
  ------------------
 3047|  4.89k|            cp++;
 3048|    653|        else
 3049|    653|            break;
 3050|  5.54k|    }
 3051|    872|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3052|    872|    if (ch == ':')
  ------------------
  |  Branch (3052:9): [True: 0, False: 872]
  ------------------
 3053|      0|        return get_node(input, output, out_len);
 3054|    872|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3055|       |
 3056|    872|    if (*input == '.')
  ------------------
  |  Branch (3056:9): [True: 3, False: 869]
  ------------------
 3057|      3|        input++;
 3058|    869|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3059|    869|    else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID)) {
  ------------------
  |  |   48|    869|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_READ_UCD_STYLE_OID)) {
  ------------------
  |  |   85|    869|#define NETSNMP_DS_LIB_READ_UCD_STYLE_OID  25   /* require top-level OIDs to be prefixed with a dot */
  ------------------
  |  Branch (3059:14): [True: 0, False: 869]
  ------------------
 3060|       |        /*
 3061|       |         * get past leading '.', append '.' to Prefix. 
 3062|       |         */
 3063|      0|        if (*Prefix == '.')
  ------------------
  |  Branch (3063:13): [True: 0, False: 0]
  ------------------
 3064|      0|            strlcpy(buf, Prefix + 1, sizeof(buf));
 3065|      0|        else
 3066|      0|            strlcpy(buf, Prefix, sizeof(buf));
 3067|      0|        strlcat(buf, ".", sizeof(buf));
 3068|      0|        strlcat(buf, input, sizeof(buf));
 3069|      0|        input = buf;
 3070|      0|    }
 3071|    872|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3072|       |
 3073|    872|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3074|    872|    if ((root == NULL) && (tree_head != NULL)) {
  ------------------
  |  Branch (3074:9): [True: 0, False: 872]
  |  Branch (3074:27): [True: 0, False: 0]
  ------------------
 3075|      0|        root = tree_head;
 3076|      0|    }
 3077|    872|    else if (root == NULL) {
  ------------------
  |  Branch (3077:14): [True: 0, False: 872]
  ------------------
 3078|      0|        SET_SNMP_ERROR(SNMPERR_NOMIB);
  ------------------
  |  |   43|      0|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3079|      0|        *out_len = 0;
 3080|      0|        return 0;
 3081|      0|    }
 3082|    872|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3083|    872|    name = strdup(input);
 3084|    872|    max_out_len = *out_len;
 3085|    872|    *out_len = 0;
 3086|    872|#ifndef NETSNMP_DISABLE_MIB_LOADING
 3087|    872|    if ((ret =
  ------------------
  |  Branch (3087:9): [True: 726, False: 146]
  ------------------
 3088|    872|         _add_strings_to_oid(root, name, output, out_len,
 3089|    872|                             max_out_len)) <= 0)
 3090|       |#else
 3091|       |    if ((ret =
 3092|       |         _add_strings_to_oid(NULL, name, output, out_len,
 3093|       |                             max_out_len)) <= 0)
 3094|       |#endif /* NETSNMP_DISABLE_MIB_LOADING */
 3095|    726|    {
 3096|    726|        if (ret == 0)
  ------------------
  |  Branch (3096:13): [True: 726, False: 0]
  ------------------
 3097|    726|            ret = SNMPERR_UNKNOWN_OBJID;
  ------------------
  |  |  242|    726|#define SNMPERR_UNKNOWN_OBJID		(-58)
  ------------------
 3098|    726|        SET_SNMP_ERROR(ret);
  ------------------
  |  |   43|    726|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 3099|    726|        SNMP_FREE(name);
  ------------------
  |  |   62|    726|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 726, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 726]
  |  |  ------------------
  ------------------
 3100|    726|        return 0;
 3101|    726|    }
 3102|    146|    SNMP_FREE(name);
  ------------------
  |  |   62|    146|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 146, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 146]
  |  |  ------------------
  ------------------
 3103|       |
 3104|    146|    return 1;
 3105|    872|}
get_module_node:
 5200|    965|{
 5201|    965|    int             modid, rc = 0;
 5202|    965|    struct tree    *tp;
 5203|    965|    char           *name, *cp;
 5204|       |
 5205|    965|    if (!strcmp(module, "ANY"))
  ------------------
  |  Branch (5205:9): [True: 801, False: 164]
  ------------------
 5206|    801|        modid = -1;
 5207|    164|    else {
 5208|    164|        netsnmp_read_module(module);
 5209|    164|        modid = which_module(module);
 5210|    164|        if (modid == -1)
  ------------------
  |  Branch (5210:13): [True: 164, False: 0]
  ------------------
 5211|    164|            return 0;
 5212|    164|    }
 5213|       |
 5214|       |    /*
 5215|       |     * Isolate the first component of the name ... 
 5216|       |     */
 5217|    801|    name = strdup(fname);
 5218|    801|    if (name == NULL)
  ------------------
  |  Branch (5218:9): [True: 0, False: 801]
  ------------------
 5219|      0|        return -1;
 5220|    801|    cp = strchr(name, '.');
 5221|    801|    if (cp != NULL) {
  ------------------
  |  Branch (5221:9): [True: 194, False: 607]
  ------------------
 5222|    194|        *cp = '\0';
 5223|    194|        cp++;
 5224|    194|    }
 5225|       |    /*
 5226|       |     * ... and locate it in the tree. 
 5227|       |     */
 5228|    801|    tp = find_tree_node(name, modid);
 5229|    801|    if (tp) {
  ------------------
  |  Branch (5229:9): [True: 168, False: 633]
  ------------------
 5230|    168|        size_t          maxlen = *objidlen;
 5231|       |
 5232|       |        /*
 5233|       |         * Set the first element of the object ID 
 5234|       |         */
 5235|    168|        if (node_to_oid(tp, objid, objidlen)) {
  ------------------
  |  Branch (5235:13): [True: 168, False: 0]
  ------------------
 5236|    168|            rc = 1;
 5237|       |
 5238|       |            /*
 5239|       |             * If the name requested was more than one element,
 5240|       |             * tag on the rest of the components 
 5241|       |             */
 5242|    168|            if (cp != NULL)
  ------------------
  |  Branch (5242:17): [True: 94, False: 74]
  ------------------
 5243|     94|                rc = _add_strings_to_oid(tp, cp, objid, objidlen, maxlen);
 5244|    168|        }
 5245|    168|    }
 5246|       |
 5247|       |    SNMP_FREE(name);
  ------------------
  |  |   62|    801|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 801, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 801]
  |  |  ------------------
  ------------------
 5248|    801|    return (rc);
 5249|    801|}
get_wild_node:
 5750|    726|{
 5751|    726|    struct tree    *tp = find_best_tree_node(name, tree_head, NULL);
 5752|    726|    if (!tp)
  ------------------
  |  Branch (5752:9): [True: 653, False: 73]
  ------------------
 5753|    653|        return 0;
 5754|     73|    return get_node(tp->label, objid, objidlen);
 5755|    726|}
get_node:
 5759|    965|{
 5760|    965|    const char     *cp;
 5761|    965|    char            ch;
 5762|    965|    int             res;
 5763|       |
 5764|    965|    cp = name;
 5765|  8.64k|    while ((ch = *cp))
  ------------------
  |  Branch (5765:12): [True: 8.46k, False: 185]
  ------------------
 5766|  8.46k|        if (('0' <= ch && ch <= '9')
  ------------------
  |  Branch (5766:14): [True: 7.48k, False: 978]
  |  Branch (5766:27): [True: 2.04k, False: 5.43k]
  ------------------
 5767|  6.41k|            || ('a' <= ch && ch <= 'z')
  ------------------
  |  Branch (5767:17): [True: 2.89k, False: 3.52k]
  |  Branch (5767:30): [True: 2.87k, False: 17]
  ------------------
 5768|  3.53k|            || ('A' <= ch && ch <= 'Z')
  ------------------
  |  Branch (5768:17): [True: 2.38k, False: 1.15k]
  |  Branch (5768:30): [True: 2.19k, False: 188]
  ------------------
 5769|  1.34k|            || ch == '-')
  ------------------
  |  Branch (5769:16): [True: 565, False: 780]
  ------------------
 5770|  7.68k|            cp++;
 5771|    780|        else
 5772|    780|            break;
 5773|    965|    if (ch != ':')
  ------------------
  |  Branch (5773:9): [True: 800, False: 165]
  ------------------
 5774|    800|        if (*name == '.')
  ------------------
  |  Branch (5774:13): [True: 3, False: 797]
  ------------------
 5775|      3|            res = get_module_node(name + 1, "ANY", objid, objidlen);
 5776|    797|        else
 5777|    797|            res = get_module_node(name, "ANY", objid, objidlen);
 5778|    165|    else {
 5779|    165|        char           *module;
 5780|    165|        size_t          module_len;
 5781|       |        /*
 5782|       |         *  requested name is of the form
 5783|       |         *      "module:subidentifier"
 5784|       |         */
 5785|    165|        module_len = (size_t) (cp - name + 1);
 5786|    165|        module = (char *) malloc(module_len);
 5787|    165|        if (!module)
  ------------------
  |  Branch (5787:13): [True: 0, False: 165]
  ------------------
 5788|      0|            return SNMPERR_GENERR;
  ------------------
  |  |  185|      0|#define SNMPERR_GENERR			(-1)
  ------------------
 5789|    165|        snprintf(module, module_len, "%.*s", (int) (cp - name), name);
 5790|    165|        cp++;                   /* cp now point to the subidentifier */
 5791|    165|        if (*cp == ':')
  ------------------
  |  Branch (5791:13): [True: 1, False: 164]
  ------------------
 5792|      1|            cp++;
 5793|       |
 5794|       |        /*
 5795|       |         * 'cp' and 'name' *do* go that way round! 
 5796|       |         */
 5797|    165|        res = get_module_node(cp, module, objid, objidlen);
 5798|    165|        SNMP_FREE(module);
  ------------------
  |  |   62|    165|#define SNMP_FREE(s)    do { if (s) { free(s); s=NULL; } } while(0)
  |  |  ------------------
  |  |  |  Branch (62:34): [True: 165, False: 0]
  |  |  |  Branch (62:66): [Folded, False: 165]
  |  |  ------------------
  ------------------
 5799|    165|    }
 5800|    965|    if (res == 0) {
  ------------------
  |  Branch (5800:9): [True: 891, False: 74]
  ------------------
 5801|    891|        SET_SNMP_ERROR(SNMPERR_UNKNOWN_OBJID);
  ------------------
  |  |   43|    891|#define SET_SNMP_ERROR(x) snmp_errno=(x)
  ------------------
 5802|    891|    }
 5803|       |
 5804|    965|    return res;
 5805|    965|}
clear_tree_flags:
 5842|    726|{
 5843|  2.90k|    for (; tp; tp = tp->next_peer) {
  ------------------
  |  Branch (5843:12): [True: 2.17k, False: 726]
  ------------------
 5844|  2.17k|        tp->reported = 0;
 5845|  2.17k|        if (tp->child_list)
  ------------------
  |  Branch (5845:13): [True: 0, False: 2.17k]
  ------------------
 5846|      0|            clear_tree_flags(tp->child_list);
 5847|  2.17k|     /*RECURSE*/}
 5848|    726|}
snmp_parse_oid:
 6103|  1.03k|{
 6104|  1.03k|#ifndef NETSNMP_DISABLE_MIB_LOADING
 6105|  1.03k|    size_t          savlen = *rootlen;
 6106|  1.03k|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 6107|  1.03k|    char           *tmpbuf = NULL;
 6108|  1.03k|    const char     *suffix, *prefix;
 6109|       |
 6110|  1.03k|    suffix = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|  1.03k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 6111|  1.03k|                                   NETSNMP_DS_LIB_OIDSUFFIX);
  ------------------
  |  |  163|  1.03k|#define NETSNMP_DS_LIB_OIDSUFFIX         12
  ------------------
 6112|  1.03k|    prefix = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|  1.03k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
 6113|  1.03k|                                   NETSNMP_DS_LIB_OIDPREFIX);
  ------------------
  |  |  164|  1.03k|#define NETSNMP_DS_LIB_OIDPREFIX         13
  ------------------
 6114|  1.03k|    if ((suffix && suffix[0]) || (prefix && prefix[0])) {
  ------------------
  |  Branch (6114:10): [True: 0, False: 1.03k]
  |  Branch (6114:20): [True: 0, False: 0]
  |  Branch (6114:35): [True: 0, False: 1.03k]
  |  Branch (6114:45): [True: 0, False: 0]
  ------------------
 6115|      0|        if (!suffix)
  ------------------
  |  Branch (6115:13): [True: 0, False: 0]
  ------------------
 6116|      0|            suffix = "";
 6117|      0|        if (!prefix)
  ------------------
  |  Branch (6117:13): [True: 0, False: 0]
  ------------------
 6118|      0|            prefix = "";
 6119|      0|        if (asprintf(&tmpbuf, "%s%s%s%s", prefix, argv,
  ------------------
  |  Branch (6119:13): [True: 0, False: 0]
  ------------------
 6120|      0|                     suffix[0] == '.' || suffix[0] == '\0' ? "" : ".",
  ------------------
  |  Branch (6120:22): [True: 0, False: 0]
  |  Branch (6120:42): [True: 0, False: 0]
  ------------------
 6121|      0|                     suffix) < 0) {
 6122|      0|            DEBUGMSGTL(("snmp_parse_oid", "Out of memory\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6123|      0|            return NULL;
 6124|      0|        }
 6125|      0|        argv = tmpbuf;
 6126|      0|        DEBUGMSGTL(("snmp_parse_oid","Parsing: %s\n",argv));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
 6127|      0|    }
 6128|       |
 6129|  1.03k|#ifndef NETSNMP_DISABLE_MIB_LOADING
 6130|  1.03k|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|  1.03k|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (6130:9): [True: 0, False: 1.03k]
  ------------------
 6131|  1.03k|                               NETSNMP_DS_LIB_RANDOM_ACCESS)
  ------------------
  |  |   74|  1.03k|#define NETSNMP_DS_LIB_RANDOM_ACCESS	   14   /* random access to oid labels */
  ------------------
 6132|  1.03k|        || strchr(argv, ':')) {
  ------------------
  |  Branch (6132:12): [True: 166, False: 872]
  ------------------
 6133|    166|        if (get_node(argv, root, rootlen))
  ------------------
  |  Branch (6133:13): [True: 1, False: 165]
  ------------------
 6134|      1|            goto out;
 6135|    872|    } else if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    872|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (6135:16): [True: 0, False: 872]
  ------------------
 6136|    872|                                      NETSNMP_DS_LIB_REGEX_ACCESS)) {
  ------------------
  |  |   75|    872|#define NETSNMP_DS_LIB_REGEX_ACCESS	   15   /* regex matching to oid labels */
  ------------------
 6137|      0|	clear_tree_flags(tree_head);
 6138|      0|        if (get_wild_node(argv, root, rootlen))
  ------------------
  |  Branch (6138:13): [True: 0, False: 0]
  ------------------
 6139|      0|            goto out;
 6140|    872|    } else {
 6141|    872|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 6142|    872|        if (read_objid(argv, root, rootlen))
  ------------------
  |  Branch (6142:13): [True: 146, False: 726]
  ------------------
 6143|    146|            goto out;
 6144|    726|#ifndef NETSNMP_DISABLE_MIB_LOADING
 6145|    726|        *rootlen = savlen;
 6146|    726|        if (get_node(argv, root, rootlen))
  ------------------
  |  Branch (6146:13): [True: 0, False: 726]
  ------------------
 6147|      0|            goto out;
 6148|    726|        *rootlen = savlen;
 6149|    726|        DEBUGMSGTL(("parse_oid", "wildly parsing\n"));
  ------------------
  |  |   66|    726|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    726|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 726]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 726]
  |  |  ------------------
  ------------------
 6150|    726|	clear_tree_flags(tree_head);
 6151|    726|        if (get_wild_node(argv, root, rootlen))
  ------------------
  |  Branch (6151:13): [True: 73, False: 653]
  ------------------
 6152|     73|            goto out;
 6153|    726|    }
 6154|    818|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 6155|       |
 6156|    818|    root = NULL;
 6157|       |
 6158|  1.03k|out:
 6159|  1.03k|    free(tmpbuf);
 6160|  1.03k|    return root;
 6161|    818|}
mib.c:node_to_oid:
 5271|    168|{
 5272|    168|    size_t          numids, lenids;
 5273|    168|    oid            *op;
 5274|       |
 5275|    168|    if (!tp || !objid || !objidlen)
  ------------------
  |  Branch (5275:9): [True: 0, False: 168]
  |  Branch (5275:16): [True: 0, False: 168]
  |  Branch (5275:26): [True: 0, False: 168]
  ------------------
 5276|      0|        return 0;
 5277|       |
 5278|    168|    lenids = *objidlen;
 5279|    168|    op = objid + lenids;        /* points after the last element */
 5280|       |
 5281|    336|    for (numids = 0; tp; tp = tp->parent, numids++) {
  ------------------
  |  Branch (5281:22): [True: 168, False: 168]
  ------------------
 5282|    168|        if (numids >= lenids)
  ------------------
  |  Branch (5282:13): [True: 0, False: 168]
  ------------------
 5283|      0|            continue;
 5284|    168|        --op;
 5285|    168|        *op = tp->subid;
 5286|    168|    }
 5287|       |
 5288|    168|    *objidlen = numids;
 5289|    168|    if (numids > lenids) {
  ------------------
  |  Branch (5289:9): [True: 0, False: 168]
  ------------------
 5290|      0|        return 0;
 5291|      0|    }
 5292|       |
 5293|    168|    if (numids < lenids)
  ------------------
  |  Branch (5293:9): [True: 168, False: 0]
  ------------------
 5294|    168|        memmove(objid, op, numids * sizeof(oid));
 5295|       |
 5296|    168|    return numids;
 5297|    168|}
mib.c:_add_strings_to_oid:
 5341|    966|{
 5342|    966|    oid             subid;
 5343|    966|    char           *fcp, *ecp, *cp2 = NULL;
 5344|    966|    char            doingquote;
 5345|    966|    int             len = -1;
 5346|    966|#ifndef NETSNMP_DISABLE_MIB_LOADING
 5347|    966|    struct tree    *tp2 = NULL;
 5348|    966|    struct index_list *in_dices = NULL;
 5349|    966|    int             pos = -1;
 5350|    966|    int             check =
 5351|    966|        !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   48|    966|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                      !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_CHECK_RANGE);
  ------------------
  |  |   76|    966|#define NETSNMP_DS_LIB_DONT_CHECK_RANGE    16   /* don't check values for ranges on send */
  ------------------
 5352|    966|    int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   48|    966|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  int             do_hint = !netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_NO_DISPLAY_HINT);
  ------------------
  |  |   90|    966|#define NETSNMP_DS_LIB_NO_DISPLAY_HINT     30 /* don't apply DISPLAY-HINTs */
  ------------------
 5353|    966|    int             len_index = 1000000;
 5354|       |
 5355|  1.11k|    while (cp && tp && tp->child_list) {
  ------------------
  |  Branch (5355:12): [True: 1.10k, False: 6]
  |  Branch (5355:18): [True: 1.10k, False: 0]
  |  Branch (5355:24): [True: 872, False: 234]
  ------------------
 5356|    872|        fcp = cp;
 5357|    872|        tp2 = tp->child_list;
 5358|       |        /*
 5359|       |         * Isolate the next entry 
 5360|       |         */
 5361|    872|        cp2 = strchr(cp, '.');
 5362|    872|        if (cp2)
  ------------------
  |  Branch (5362:13): [True: 232, False: 640]
  ------------------
 5363|    232|            *cp2++ = '\0';
 5364|       |
 5365|       |        /*
 5366|       |         * Search for the appropriate child 
 5367|       |         */
 5368|    872|        if (isdigit((unsigned char)(*cp))) {
  ------------------
  |  Branch (5368:13): [True: 225, False: 647]
  ------------------
 5369|    225|            subid = strtoul(cp, &ecp, 0);
 5370|    225|            if (*ecp)
  ------------------
  |  Branch (5370:17): [True: 24, False: 201]
  ------------------
 5371|     24|                goto bad_id;
 5372|    697|            while (tp2 && tp2->subid != subid)
  ------------------
  |  Branch (5372:20): [True: 546, False: 151]
  |  Branch (5372:27): [True: 496, False: 50]
  ------------------
 5373|    496|                tp2 = tp2->next_peer;
 5374|    647|        } else {
 5375|  2.30k|            while (tp2 && strcmp(tp2->label, fcp))
  ------------------
  |  Branch (5375:20): [True: 1.75k, False: 551]
  |  Branch (5375:27): [True: 1.65k, False: 96]
  ------------------
 5376|  1.65k|                tp2 = tp2->next_peer;
 5377|    647|            if (!tp2)
  ------------------
  |  Branch (5377:17): [True: 551, False: 96]
  ------------------
 5378|    551|                goto bad_id;
 5379|     96|            subid = tp2->subid;
 5380|     96|        }
 5381|    297|        if (*objidlen >= maxlen)
  ------------------
  |  Branch (5381:13): [True: 0, False: 297]
  ------------------
 5382|      0|            goto bad_id;
 5383|    297|	while (tp2 && tp2->next_peer && tp2->next_peer->subid == subid)
  ------------------
  |  Branch (5383:9): [True: 146, False: 151]
  |  Branch (5383:16): [True: 132, False: 14]
  |  Branch (5383:34): [True: 0, False: 132]
  ------------------
 5384|      0|	    tp2 = tp2->next_peer;
 5385|    297|        objid[*objidlen] = subid;
 5386|    297|        (*objidlen)++;
 5387|       |
 5388|    297|        cp = cp2;
 5389|    297|        if (!tp2)
  ------------------
  |  Branch (5389:13): [True: 151, False: 146]
  ------------------
 5390|    151|            break;
 5391|    146|        tp = tp2;
 5392|    146|    }
 5393|       |
 5394|    391|    if (tp && !tp->child_list) {
  ------------------
  |  Branch (5394:9): [True: 391, False: 0]
  |  Branch (5394:15): [True: 240, False: 151]
  ------------------
 5395|    240|        if ((tp2 = tp->parent)) {
  ------------------
  |  Branch (5395:13): [True: 0, False: 240]
  ------------------
 5396|      0|            if (tp2->indexes)
  ------------------
  |  Branch (5396:17): [True: 0, False: 0]
  ------------------
 5397|      0|                in_dices = tp2->indexes;
 5398|      0|            else if (tp2->augments) {
  ------------------
  |  Branch (5398:22): [True: 0, False: 0]
  ------------------
 5399|      0|                tp2 = find_tree_node(tp2->augments, -1);
 5400|      0|                if (tp2)
  ------------------
  |  Branch (5400:21): [True: 0, False: 0]
  ------------------
 5401|      0|                    in_dices = tp2->indexes;
 5402|      0|            }
 5403|      0|        }
 5404|    240|        tp = NULL;
 5405|    240|    }
 5406|       |
 5407|    391|    while (cp && in_dices) {
  ------------------
  |  Branch (5407:12): [True: 284, False: 107]
  |  Branch (5407:18): [True: 0, False: 284]
  ------------------
 5408|      0|        fcp = cp;
 5409|       |
 5410|      0|        tp = find_tree_node(in_dices->ilabel, -1);
 5411|      0|        if (!tp)
  ------------------
  |  Branch (5411:13): [True: 0, False: 0]
  ------------------
 5412|      0|            break;
 5413|      0|        switch (tp->type) {
 5414|      0|        case TYPE_INTEGER:
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (5414:9): [True: 0, False: 0]
  ------------------
 5415|      0|        case TYPE_INTEGER32:
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (5415:9): [True: 0, False: 0]
  ------------------
 5416|      0|        case TYPE_UINTEGER:
  ------------------
  |  |  168|      0|#define TYPE_UINTEGER       14
  ------------------
  |  Branch (5416:9): [True: 0, False: 0]
  ------------------
 5417|      0|        case TYPE_UNSIGNED32:
  ------------------
  |  |  169|      0|#define TYPE_UNSIGNED32     15
  ------------------
  |  Branch (5417:9): [True: 0, False: 0]
  ------------------
 5418|      0|        case TYPE_TIMETICKS:
  ------------------
  |  |  162|      0|#define TYPE_TIMETICKS      8
  ------------------
  |  Branch (5418:9): [True: 0, False: 0]
  ------------------
 5419|       |            /*
 5420|       |             * Isolate the next entry 
 5421|       |             */
 5422|      0|            cp2 = strchr(cp, '.');
 5423|      0|            if (cp2)
  ------------------
  |  Branch (5423:17): [True: 0, False: 0]
  ------------------
 5424|      0|                *cp2++ = '\0';
 5425|      0|            if (isdigit((unsigned char)(*cp))) {
  ------------------
  |  Branch (5425:17): [True: 0, False: 0]
  ------------------
 5426|      0|                subid = strtoul(cp, &ecp, 0);
 5427|      0|                if (*ecp)
  ------------------
  |  Branch (5427:21): [True: 0, False: 0]
  ------------------
 5428|      0|                    goto bad_id;
 5429|      0|            } else {
 5430|      0|                if (tp->enums) {
  ------------------
  |  Branch (5430:21): [True: 0, False: 0]
  ------------------
 5431|      0|                    struct enum_list *ep = tp->enums;
 5432|      0|                    while (ep && strcmp(ep->label, cp))
  ------------------
  |  Branch (5432:28): [True: 0, False: 0]
  |  Branch (5432:34): [True: 0, False: 0]
  ------------------
 5433|      0|                        ep = ep->next;
 5434|      0|                    if (!ep)
  ------------------
  |  Branch (5434:25): [True: 0, False: 0]
  ------------------
 5435|      0|                        goto bad_id;
 5436|      0|                    subid = ep->value;
 5437|      0|                } else
 5438|      0|                    goto bad_id;
 5439|      0|            }
 5440|      0|            if (check && tp->ranges) {
  ------------------
  |  Branch (5440:17): [True: 0, False: 0]
  |  Branch (5440:26): [True: 0, False: 0]
  ------------------
 5441|      0|                struct range_list *rp = tp->ranges;
 5442|      0|                int             ok = 0;
 5443|      0|                if (tp->type == TYPE_INTEGER ||
  ------------------
  |  |  157|      0|#define TYPE_INTEGER        3
  ------------------
  |  Branch (5443:21): [True: 0, False: 0]
  ------------------
 5444|      0|                    tp->type == TYPE_INTEGER32) {
  ------------------
  |  |  170|      0|#define TYPE_INTEGER32      16
  ------------------
  |  Branch (5444:21): [True: 0, False: 0]
  ------------------
 5445|      0|                  while (!ok && rp) {
  ------------------
  |  Branch (5445:26): [True: 0, False: 0]
  |  Branch (5445:33): [True: 0, False: 0]
  ------------------
 5446|      0|                    if ((rp->low <= (int) subid)
  ------------------
  |  Branch (5446:25): [True: 0, False: 0]
  ------------------
 5447|      0|                        && ((int) subid <= rp->high))
  ------------------
  |  Branch (5447:28): [True: 0, False: 0]
  ------------------
 5448|      0|                        ok = 1;
 5449|      0|                    else
 5450|      0|                        rp = rp->next;
 5451|      0|                  }
 5452|      0|                } else { /* check unsigned range */
 5453|      0|                  while (!ok && rp) {
  ------------------
  |  Branch (5453:26): [True: 0, False: 0]
  |  Branch (5453:33): [True: 0, False: 0]
  ------------------
 5454|      0|                    if (((unsigned int)rp->low <= subid)
  ------------------
  |  Branch (5454:25): [True: 0, False: 0]
  ------------------
 5455|      0|                        && (subid <= (unsigned int)rp->high))
  ------------------
  |  Branch (5455:28): [True: 0, False: 0]
  ------------------
 5456|      0|                        ok = 1;
 5457|      0|                    else
 5458|      0|                        rp = rp->next;
 5459|      0|                  }
 5460|      0|                }
 5461|      0|                if (!ok)
  ------------------
  |  Branch (5461:21): [True: 0, False: 0]
  ------------------
 5462|      0|                    goto bad_id;
 5463|      0|            }
 5464|      0|            if (*objidlen >= maxlen)
  ------------------
  |  Branch (5464:17): [True: 0, False: 0]
  ------------------
 5465|      0|                goto bad_id;
 5466|      0|            objid[*objidlen] = subid;
 5467|      0|            (*objidlen)++;
 5468|      0|            break;
 5469|      0|        case TYPE_IPADDR:
  ------------------
  |  |  159|      0|#define TYPE_IPADDR         5
  ------------------
  |  Branch (5469:9): [True: 0, False: 0]
  ------------------
 5470|      0|            if (*objidlen + 4 > maxlen)
  ------------------
  |  Branch (5470:17): [True: 0, False: 0]
  ------------------
 5471|      0|                goto bad_id;
 5472|      0|            for (subid = 0; cp && subid < 4; subid++) {
  ------------------
  |  Branch (5472:29): [True: 0, False: 0]
  |  Branch (5472:35): [True: 0, False: 0]
  ------------------
 5473|      0|                fcp = cp;
 5474|      0|                cp2 = strchr(cp, '.');
 5475|      0|                if (cp2)
  ------------------
  |  Branch (5475:21): [True: 0, False: 0]
  ------------------
 5476|      0|                    *cp2++ = 0;
 5477|      0|                objid[*objidlen] = strtoul(cp, &ecp, 0);
 5478|      0|                if (*ecp)
  ------------------
  |  Branch (5478:21): [True: 0, False: 0]
  ------------------
 5479|      0|                    goto bad_id;
 5480|      0|                if (check && objid[*objidlen] > 255)
  ------------------
  |  Branch (5480:21): [True: 0, False: 0]
  |  Branch (5480:30): [True: 0, False: 0]
  ------------------
 5481|      0|                    goto bad_id;
 5482|      0|                (*objidlen)++;
 5483|      0|                cp = cp2;
 5484|      0|            }
 5485|      0|            break;
 5486|      0|        case TYPE_OCTETSTR:
  ------------------
  |  |  156|      0|#define TYPE_OCTETSTR       2
  ------------------
  |  Branch (5486:9): [True: 0, False: 0]
  ------------------
 5487|      0|            if (tp->ranges && !tp->ranges->next
  ------------------
  |  Branch (5487:17): [True: 0, False: 0]
  |  Branch (5487:31): [True: 0, False: 0]
  ------------------
 5488|      0|                && tp->ranges->low == tp->ranges->high)
  ------------------
  |  Branch (5488:20): [True: 0, False: 0]
  ------------------
 5489|      0|                len = tp->ranges->low;
 5490|      0|            else
 5491|      0|                len = -1;
 5492|      0|            pos = 0;
 5493|      0|            if (*cp == '"' || *cp == '\'') {
  ------------------
  |  Branch (5493:17): [True: 0, False: 0]
  |  Branch (5493:31): [True: 0, False: 0]
  ------------------
 5494|      0|                doingquote = *cp++;
 5495|       |                /*
 5496|       |                 * insert length if requested 
 5497|       |                 */
 5498|      0|                if (!in_dices->isimplied && len == -1) {
  ------------------
  |  Branch (5498:21): [True: 0, False: 0]
  |  Branch (5498:45): [True: 0, False: 0]
  ------------------
 5499|      0|                    if (doingquote == '\'') {
  ------------------
  |  Branch (5499:25): [True: 0, False: 0]
  ------------------
 5500|      0|                        snmp_set_detail
 5501|      0|                            ("'-quote is for fixed length strings");
 5502|      0|                        return 0;
 5503|      0|                    }
 5504|      0|                    if (*objidlen >= maxlen)
  ------------------
  |  Branch (5504:25): [True: 0, False: 0]
  ------------------
 5505|      0|                        goto bad_id;
 5506|      0|                    len_index = *objidlen;
 5507|      0|                    (*objidlen)++;
 5508|      0|                } else if (doingquote == '"') {
  ------------------
  |  Branch (5508:28): [True: 0, False: 0]
  ------------------
 5509|      0|                    snmp_set_detail
 5510|      0|                        ("\"-quote is for variable length strings");
 5511|      0|                    return 0;
 5512|      0|                }
 5513|       |
 5514|      0|		cp2 = _apply_escapes(cp, doingquote);
 5515|      0|		if (!cp2) goto bad_id;
  ------------------
  |  Branch (5515:7): [True: 0, False: 0]
  ------------------
 5516|      0|		else {
 5517|      0|		    unsigned char *new_val;
 5518|      0|		    int new_val_len;
 5519|      0|		    int parsed_hint = 0;
 5520|      0|		    const char *parsed_value;
 5521|       |
 5522|      0|		    if (do_hint && tp->hint) {
  ------------------
  |  Branch (5522:11): [True: 0, False: 0]
  |  Branch (5522:22): [True: 0, False: 0]
  ------------------
 5523|      0|			parsed_value = parse_octet_hint(tp->hint, cp,
 5524|      0|			                                &new_val, &new_val_len);
 5525|      0|			parsed_hint = parsed_value == NULL;
 5526|      0|		    }
 5527|      0|		    if (parsed_hint) {
  ------------------
  |  Branch (5527:11): [True: 0, False: 0]
  ------------------
 5528|      0|			int i;
 5529|      0|			for (i = 0; i < new_val_len; i++) {
  ------------------
  |  Branch (5529:16): [True: 0, False: 0]
  ------------------
 5530|      0|			    if (*objidlen >= maxlen) {
  ------------------
  |  Branch (5530:12): [True: 0, False: 0]
  ------------------
 5531|      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, False: 0]
  |  |  ------------------
  ------------------
 5532|      0|				goto bad_id;
 5533|      0|			    }
 5534|      0|			    objid[ *objidlen ] = new_val[i];
 5535|      0|			    (*objidlen)++;
 5536|      0|			    pos++;
 5537|      0|			}
 5538|      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, False: 0]
  |  |  ------------------
  ------------------
 5539|      0|		    } else {
 5540|      0|			while(*cp) {
  ------------------
  |  Branch (5540:10): [True: 0, False: 0]
  ------------------
 5541|      0|			    if (*objidlen >= maxlen) goto bad_id;
  ------------------
  |  Branch (5541:12): [True: 0, False: 0]
  ------------------
 5542|      0|			    objid[ *objidlen ] = *cp++;
 5543|      0|			    (*objidlen)++;
 5544|      0|			    pos++;
 5545|      0|			}
 5546|      0|		    }
 5547|      0|		}
 5548|       |		
 5549|      0|		cp2++;
 5550|      0|                if (!*cp2)
  ------------------
  |  Branch (5550:21): [True: 0, False: 0]
  ------------------
 5551|      0|                    cp2 = NULL;
 5552|      0|                else if (*cp2 != '.')
  ------------------
  |  Branch (5552:26): [True: 0, False: 0]
  ------------------
 5553|      0|                    goto bad_id;
 5554|      0|                else
 5555|      0|                    cp2++;
 5556|      0|		if (check) {
  ------------------
  |  Branch (5556:7): [True: 0, False: 0]
  ------------------
 5557|      0|                    if (len == -1) {
  ------------------
  |  Branch (5557:25): [True: 0, False: 0]
  ------------------
 5558|      0|                        struct range_list *rp = tp->ranges;
 5559|      0|                        int             ok = 0;
 5560|      0|                        while (rp && !ok)
  ------------------
  |  Branch (5560:32): [True: 0, False: 0]
  |  Branch (5560:38): [True: 0, False: 0]
  ------------------
 5561|      0|                            if (rp->low <= pos && pos <= rp->high)
  ------------------
  |  Branch (5561:33): [True: 0, False: 0]
  |  Branch (5561:51): [True: 0, False: 0]
  ------------------
 5562|      0|                                ok = 1;
 5563|      0|                            else
 5564|      0|                                rp = rp->next;
 5565|      0|                        if (!ok)
  ------------------
  |  Branch (5565:29): [True: 0, False: 0]
  ------------------
 5566|      0|                            goto bad_id;
 5567|      0|                        if (!in_dices->isimplied)
  ------------------
  |  Branch (5567:29): [True: 0, False: 0]
  ------------------
 5568|      0|                            objid[len_index] = pos;
 5569|      0|                    } else if (pos != len)
  ------------------
  |  Branch (5569:32): [True: 0, False: 0]
  ------------------
 5570|      0|                        goto bad_id;
 5571|      0|		}
 5572|      0|		else if (len == -1 && !in_dices->isimplied)
  ------------------
  |  Branch (5572:12): [True: 0, False: 0]
  |  Branch (5572:25): [True: 0, False: 0]
  ------------------
 5573|      0|		    objid[len_index] = pos;
 5574|      0|            } else {
 5575|      0|                if (!in_dices->isimplied && len == -1) {
  ------------------
  |  Branch (5575:21): [True: 0, False: 0]
  |  Branch (5575:45): [True: 0, False: 0]
  ------------------
 5576|      0|                    fcp = cp;
 5577|      0|                    cp2 = strchr(cp, '.');
 5578|      0|                    if (cp2)
  ------------------
  |  Branch (5578:25): [True: 0, False: 0]
  ------------------
 5579|      0|                        *cp2++ = 0;
 5580|      0|                    len = strtoul(cp, &ecp, 0);
 5581|      0|                    if (len < 0 || *ecp)
  ------------------
  |  Branch (5581:25): [True: 0, False: 0]
  |  Branch (5581:36): [True: 0, False: 0]
  ------------------
 5582|      0|                        goto bad_id;
 5583|      0|                    if (*objidlen + len + 1 >= maxlen)
  ------------------
  |  Branch (5583:25): [True: 0, False: 0]
  ------------------
 5584|      0|                        goto bad_id;
 5585|      0|                    objid[*objidlen] = len;
 5586|      0|                    (*objidlen)++;
 5587|      0|                    cp = cp2;
 5588|      0|                }
 5589|      0|                while (len && cp) {
  ------------------
  |  Branch (5589:24): [True: 0, False: 0]
  |  Branch (5589:31): [True: 0, False: 0]
  ------------------
 5590|      0|                    fcp = cp;
 5591|      0|                    cp2 = strchr(cp, '.');
 5592|      0|                    if (cp2)
  ------------------
  |  Branch (5592:25): [True: 0, False: 0]
  ------------------
 5593|      0|                        *cp2++ = 0;
 5594|      0|                    if (*objidlen >= maxlen)
  ------------------
  |  Branch (5594:25): [True: 0, False: 0]
  ------------------
 5595|      0|                        goto bad_id;
 5596|      0|                    objid[*objidlen] = strtoul(cp, &ecp, 0);
 5597|      0|                    if (*ecp)
  ------------------
  |  Branch (5597:25): [True: 0, False: 0]
  ------------------
 5598|      0|                        goto bad_id;
 5599|      0|                    if (check && objid[*objidlen] > 255)
  ------------------
  |  Branch (5599:25): [True: 0, False: 0]
  |  Branch (5599:34): [True: 0, False: 0]
  ------------------
 5600|      0|                        goto bad_id;
 5601|      0|                    (*objidlen)++;
 5602|      0|                    len--;
 5603|      0|                    cp = cp2;
 5604|      0|                }
 5605|      0|            }
 5606|      0|            break;
 5607|      0|        case TYPE_OBJID:
  ------------------
  |  |  155|      0|#define TYPE_OBJID          1
  ------------------
  |  Branch (5607:9): [True: 0, False: 0]
  ------------------
 5608|      0|            in_dices = NULL;
 5609|      0|            cp2 = cp;
 5610|      0|            break;
 5611|      0|	case TYPE_NETADDR:
  ------------------
  |  |  158|      0|#define TYPE_NETADDR        4
  ------------------
  |  Branch (5611:2): [True: 0, False: 0]
  ------------------
 5612|      0|	    fcp = cp;
 5613|      0|	    cp2 = strchr(cp, '.');
 5614|      0|	    if (cp2)
  ------------------
  |  Branch (5614:10): [True: 0, False: 0]
  ------------------
 5615|      0|		*cp2++ = 0;
 5616|      0|	    subid = strtoul(cp, &ecp, 0);
 5617|      0|	    if (*ecp)
  ------------------
  |  Branch (5617:10): [True: 0, False: 0]
  ------------------
 5618|      0|		goto bad_id;
 5619|      0|	    if (*objidlen + 1 >= maxlen)
  ------------------
  |  Branch (5619:10): [True: 0, False: 0]
  ------------------
 5620|      0|		goto bad_id;
 5621|      0|	    objid[*objidlen] = subid;
 5622|      0|	    (*objidlen)++;
 5623|      0|	    cp = cp2;
 5624|      0|	    if (subid == 1) {
  ------------------
  |  Branch (5624:10): [True: 0, False: 0]
  ------------------
 5625|      0|		for (len = 0; cp && len < 4; len++) {
  ------------------
  |  Branch (5625:17): [True: 0, False: 0]
  |  Branch (5625:23): [True: 0, False: 0]
  ------------------
 5626|      0|		    fcp = cp;
 5627|      0|		    cp2 = strchr(cp, '.');
 5628|      0|		    if (cp2)
  ------------------
  |  Branch (5628:11): [True: 0, False: 0]
  ------------------
 5629|      0|			*cp2++ = 0;
 5630|      0|		    subid = strtoul(cp, &ecp, 0);
 5631|      0|		    if (*ecp)
  ------------------
  |  Branch (5631:11): [True: 0, False: 0]
  ------------------
 5632|      0|			goto bad_id;
 5633|      0|		    if (*objidlen + 1 >= maxlen)
  ------------------
  |  Branch (5633:11): [True: 0, False: 0]
  ------------------
 5634|      0|			goto bad_id;
 5635|      0|		    if (check && subid > 255)
  ------------------
  |  Branch (5635:11): [True: 0, False: 0]
  |  Branch (5635:20): [True: 0, False: 0]
  ------------------
 5636|      0|			goto bad_id;
 5637|      0|		    objid[*objidlen] = subid;
 5638|      0|		    (*objidlen)++;
 5639|      0|		    cp = cp2;
 5640|      0|		}
 5641|      0|	    }
 5642|      0|	    else {
 5643|      0|		in_dices = NULL;
 5644|      0|	    }
 5645|      0|	    break;
 5646|      0|        default:
  ------------------
  |  Branch (5646:9): [True: 0, False: 0]
  ------------------
 5647|      0|            snmp_log(LOG_ERR, "Unexpected index type: %d %s %s\n",
 5648|      0|                     tp->type, in_dices->ilabel, cp);
 5649|      0|            in_dices = NULL;
 5650|      0|            cp2 = cp;
 5651|      0|            break;
 5652|      0|        }
 5653|      0|        cp = cp2;
 5654|      0|        if (in_dices)
  ------------------
  |  Branch (5654:13): [True: 0, False: 0]
  ------------------
 5655|      0|            in_dices = in_dices->next;
 5656|      0|    }
 5657|       |
 5658|    391|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 5659|  3.32k|    while (cp) {
  ------------------
  |  Branch (5659:12): [True: 3.17k, False: 146]
  ------------------
 5660|  3.17k|        fcp = cp;
 5661|  3.17k|        switch (*cp) {
 5662|    228|        case '0':
  ------------------
  |  Branch (5662:9): [True: 228, False: 2.94k]
  ------------------
 5663|    425|        case '1':
  ------------------
  |  Branch (5663:9): [True: 197, False: 2.97k]
  ------------------
 5664|    622|        case '2':
  ------------------
  |  Branch (5664:9): [True: 197, False: 2.97k]
  ------------------
 5665|    820|        case '3':
  ------------------
  |  Branch (5665:9): [True: 198, False: 2.97k]
  ------------------
 5666|  1.01k|        case '4':
  ------------------
  |  Branch (5666:9): [True: 194, False: 2.98k]
  ------------------
 5667|  1.27k|        case '5':
  ------------------
  |  Branch (5667:9): [True: 257, False: 2.91k]
  ------------------
 5668|  1.46k|        case '6':
  ------------------
  |  Branch (5668:9): [True: 196, False: 2.97k]
  ------------------
 5669|  1.66k|        case '7':
  ------------------
  |  Branch (5669:9): [True: 196, False: 2.97k]
  ------------------
 5670|  1.86k|        case '8':
  ------------------
  |  Branch (5670:9): [True: 199, False: 2.97k]
  ------------------
 5671|  2.05k|        case '9':
  ------------------
  |  Branch (5671:9): [True: 197, False: 2.97k]
  ------------------
 5672|  2.05k|            cp2 = strchr(cp, '.');
 5673|  2.05k|            if (cp2)
  ------------------
  |  Branch (5673:17): [True: 1.95k, False: 102]
  ------------------
 5674|  1.95k|                *cp2++ = 0;
 5675|  2.05k|            subid = strtoul(cp, &ecp, 0);
 5676|  2.05k|            if (*ecp)
  ------------------
  |  Branch (5676:17): [True: 64, False: 1.99k]
  ------------------
 5677|     64|                goto bad_id;
 5678|  1.99k|            if (*objidlen >= maxlen)
  ------------------
  |  Branch (5678:17): [True: 3, False: 1.99k]
  ------------------
 5679|      3|                goto bad_id;
 5680|  1.99k|            objid[*objidlen] = subid;
 5681|  1.99k|            (*objidlen)++;
 5682|  1.99k|            break;
 5683|    430|        case '"':
  ------------------
  |  Branch (5683:9): [True: 430, False: 2.74k]
  ------------------
 5684|  1.04k|        case '\'':
  ------------------
  |  Branch (5684:9): [True: 611, False: 2.56k]
  ------------------
 5685|  1.04k|            doingquote = *cp++;
 5686|  1.04k|            if (*cp == '\0')
  ------------------
  |  Branch (5686:17): [True: 28, False: 1.01k]
  ------------------
 5687|     28|                goto bad_id;
 5688|       |            /*
 5689|       |             * insert length if requested 
 5690|       |             */
 5691|  1.01k|            if (doingquote == '"') {
  ------------------
  |  Branch (5691:17): [True: 416, False: 597]
  ------------------
 5692|    416|                char *endq;
 5693|    416|                if (*objidlen >= maxlen)
  ------------------
  |  Branch (5693:21): [True: 3, False: 413]
  ------------------
 5694|      3|                    goto bad_id;
 5695|    413|                endq = strchr(cp, doingquote);
 5696|    413|                if (!endq)
  ------------------
  |  Branch (5696:21): [True: 9, False: 404]
  ------------------
 5697|      9|                    goto bad_id;
 5698|    404|                objid[*objidlen] = len = endq - cp;
 5699|    404|                (*objidlen)++;
 5700|    404|            }
 5701|       |
 5702|  2.82k|            while (*cp && *cp != doingquote) {
  ------------------
  |  Branch (5702:20): [True: 2.78k, False: 38]
  |  Branch (5702:27): [True: 1.82k, False: 960]
  ------------------
 5703|  1.82k|                if (*objidlen >= maxlen)
  ------------------
  |  Branch (5703:21): [True: 3, False: 1.82k]
  ------------------
 5704|      3|                    goto bad_id;
 5705|  1.82k|                objid[*objidlen] = *cp++;
 5706|  1.82k|                (*objidlen)++;
 5707|  1.82k|            }
 5708|    998|            if (!*cp)
  ------------------
  |  Branch (5708:17): [True: 38, False: 960]
  ------------------
 5709|     38|                goto bad_id;
 5710|    960|            cp2 = cp + 1;
 5711|    960|            if (!*cp2)
  ------------------
  |  Branch (5711:17): [True: 4, False: 956]
  ------------------
 5712|      4|                cp2 = NULL;
 5713|    956|            else if (*cp2 == '.')
  ------------------
  |  Branch (5713:22): [True: 933, False: 23]
  ------------------
 5714|    933|                cp2++;
 5715|     23|            else
 5716|     23|                goto bad_id;
 5717|    937|            break;
 5718|    937|        default:
  ------------------
  |  Branch (5718:9): [True: 74, False: 3.10k]
  ------------------
 5719|     74|            goto bad_id;
 5720|  3.17k|        }
 5721|  2.92k|        cp = cp2;
 5722|  2.92k|    }
 5723|    146|    return 1;
 5724|       |
 5725|    820|  bad_id:
 5726|    820|    {
 5727|    820|        char            buf[256];
 5728|    820|#ifndef NETSNMP_DISABLE_MIB_LOADING
 5729|    820|        if (in_dices)
  ------------------
  |  Branch (5729:13): [True: 0, False: 820]
  ------------------
 5730|      0|            snprintf(buf, sizeof(buf), "Index out of range: %s (%s)",
 5731|      0|                    fcp, in_dices->ilabel);
 5732|    820|        else if (tp)
  ------------------
  |  Branch (5732:18): [True: 603, False: 217]
  ------------------
 5733|    603|            snprintf(buf, sizeof(buf), "Sub-id not found: %s -> %s", tp->label, fcp);
 5734|    217|        else
 5735|    217|#endif /* NETSNMP_DISABLE_MIB_LOADING */
 5736|    217|            snprintf(buf, sizeof(buf), "%s", fcp);
 5737|       |
 5738|    820|        snmp_set_detail(buf);
 5739|    820|    }
 5740|    820|    return 0;
 5741|    391|}

netsnmp_init_mib_internals:
  701|    274|{
  702|    274|    register struct tok *tp;
  703|    274|    register int    b, i;
  704|    274|    int             max_modc;
  705|       |
  706|    274|    if (tree_head)
  ------------------
  |  Branch (706:9): [True: 272, False: 2]
  ------------------
  707|    272|        return;
  708|       |
  709|       |    /*
  710|       |     * Set up hash list of pre-defined tokens
  711|       |     */
  712|      2|    memset(buckets, 0, sizeof(buckets));
  713|    186|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (713:23): [True: 184, False: 2]
  ------------------
  714|    184|        tp->hash = name_hash(tp->name);
  715|    184|        b = BUCKET(tp->hash);
  ------------------
  |  |  527|    184|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  526|    184|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  716|    184|        if (buckets[b])
  ------------------
  |  Branch (716:13): [True: 120, False: 64]
  ------------------
  717|    120|            tp->next = buckets[b];      /* BUG ??? */
  718|    184|        buckets[b] = tp;
  719|    184|    }
  720|       |
  721|       |    /*
  722|       |     * Initialise other internal structures
  723|       |     */
  724|       |
  725|      2|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  726|     44|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (726:17): [True: 42, False: 2]
  ------------------
  727|     42|        module_map[i].next = &(module_map[i + 1]);
  728|      2|    module_map[max_modc].next = NULL;
  729|      2|    module_map_head = module_map;
  730|       |
  731|      2|    memset(nbuckets, 0, sizeof(nbuckets));
  732|      2|    memset(tbuckets, 0, sizeof(tbuckets));
  733|      2|    free(tclist);
  734|      2|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|      2|#define TC_INCR 100
  ------------------
  735|      2|    tclist = calloc(tc_alloc, sizeof(struct tc));
  736|      2|    build_translation_table();
  737|      2|    init_tree_roots();          /* Set up initial roots */
  738|       |    /*
  739|       |     * Relies on 'add_mibdir' having set up the modules 
  740|       |     */
  741|      2|}
find_tree_node:
 1244|    801|{
 1245|    801|    struct tree    *tp, *headtp;
 1246|    801|    int             count, *int_p;
 1247|       |
 1248|    801|    if (!name || !*name)
  ------------------
  |  Branch (1248:9): [True: 0, False: 801]
  |  Branch (1248:18): [True: 2, False: 799]
  ------------------
 1249|      2|        return (NULL);
 1250|       |
 1251|    799|    headtp = tbuckets[NBUCKET(name_hash(name))];
  ------------------
  |  |  530|    799|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|    799|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1252|    936|    for (tp = headtp; tp; tp = tp->next) {
  ------------------
  |  Branch (1252:23): [True: 305, False: 631]
  ------------------
 1253|    305|        if (tp->label && !label_compare(tp->label, name)) {
  ------------------
  |  | 1238|    305|#define	label_compare	strcmp
  ------------------
  |  Branch (1253:13): [True: 305, False: 0]
  |  Branch (1253:26): [True: 168, False: 137]
  ------------------
 1254|       |
 1255|    168|            if (modid == -1)    /* Any module */
  ------------------
  |  Branch (1255:17): [True: 168, False: 0]
  ------------------
 1256|    168|                return (tp);
 1257|       |
 1258|      0|            for (int_p = tp->module_list, count = 0;
 1259|      0|                 count < tp->number_modules; ++count, ++int_p)
  ------------------
  |  Branch (1259:18): [True: 0, False: 0]
  ------------------
 1260|      0|                if (*int_p == modid)
  ------------------
  |  Branch (1260:21): [True: 0, False: 0]
  ------------------
 1261|      0|                    return (tp);
 1262|      0|        }
 1263|    305|    }
 1264|       |
 1265|    631|    return (NULL);
 1266|    799|}
find_best_tree_node:
 1520|    726|{
 1521|    726|#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
 1522|    726|    regex_t         parsetree;
 1523|    726|    struct tree    *best_so_far;
 1524|    726|#endif
 1525|       |
 1526|    726|    if (match)
  ------------------
  |  Branch (1526:9): [True: 0, False: 726]
  ------------------
 1527|      0|        *match = MAX_BAD;
  ------------------
  |  | 1273|      0|#define MAX_BAD 0xffffff
  ------------------
 1528|       |
 1529|    726|    if (!pattrn || !*pattrn)
  ------------------
  |  Branch (1529:9): [True: 0, False: 726]
  |  Branch (1529:20): [True: 1, False: 725]
  ------------------
 1530|      1|        return (NULL);
 1531|       |
 1532|    725|    if (!tree_top)
  ------------------
  |  Branch (1532:9): [True: 0, False: 725]
  ------------------
 1533|      0|        tree_top = get_tree_head();
 1534|       |
 1535|    725|#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
 1536|    725|    if (regex_too_complex(pattrn))
  ------------------
  |  Branch (1536:9): [True: 196, False: 529]
  ------------------
 1537|    196|        return (NULL);
 1538|    529|    if (regcomp(&parsetree, pattrn, REG_ICASE | REG_EXTENDED) != 0)
  ------------------
  |  Branch (1538:9): [True: 20, False: 509]
  ------------------
 1539|     20|        return (NULL);
 1540|    509|    best_so_far = find_best_tree_node_r(&parsetree, tree_top, match);
 1541|    509|    regfree(&parsetree);
 1542|    509|    return best_so_far;
 1543|       |#else
 1544|       |    return find_best_tree_node_r(pattrn, tree_top, match);
 1545|       |#endif
 1546|    529|}
which_module:
 4248|    170|{
 4249|    170|    struct module  *mp;
 4250|       |
 4251|    170|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (4251:28): [True: 0, False: 170]
  ------------------
 4252|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1238|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (4252:13): [True: 0, False: 0]
  ------------------
 4253|      0|            return (mp->modid);
 4254|       |
 4255|    170|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   66|    170|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    170|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 170]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 170]
  |  |  ------------------
  ------------------
 4256|    170|    return (-1);
 4257|    170|}
adopt_orphans:
 4446|      2|{
 4447|      2|    struct node    *np = NULL, *onp;
 4448|      2|    struct tree    *tp;
 4449|      2|    int             i, adopted = 1;
 4450|       |
 4451|      2|    if (!orphan_nodes)
  ------------------
  |  Branch (4451:9): [True: 2, False: 0]
  ------------------
 4452|      2|        return;
 4453|      0|    init_node_hash(orphan_nodes);
 4454|      0|    orphan_nodes = NULL;
 4455|       |
 4456|      0|    while (adopted) {
  ------------------
  |  Branch (4456:12): [True: 0, False: 0]
  ------------------
 4457|      0|        adopted = 0;
 4458|      0|        for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4458:21): [True: 0, False: 0]
  ------------------
 4459|      0|            if (nbuckets[i]) {
  ------------------
  |  Branch (4459:17): [True: 0, False: 0]
  ------------------
 4460|      0|                for (np = nbuckets[i]; np != NULL; np = np->next) {
  ------------------
  |  Branch (4460:40): [True: 0, False: 0]
  ------------------
 4461|      0|                    tp = find_tree_node(np->parent, -1);
 4462|      0|		    if (tp) {
  ------------------
  |  Branch (4462:11): [True: 0, False: 0]
  ------------------
 4463|      0|			do_subtree(tp, &np);
 4464|      0|			adopted = 1;
 4465|       |                        /*
 4466|       |                         * if do_subtree adopted the entire bucket, stop
 4467|       |                         */
 4468|      0|                        if(NULL == nbuckets[i])
  ------------------
  |  Branch (4468:28): [True: 0, False: 0]
  ------------------
 4469|      0|                            break;
 4470|       |
 4471|       |                        /*
 4472|       |                         * do_subtree may modify nbuckets, and if np
 4473|       |                         * was adopted, np->next probably isn't an orphan
 4474|       |                         * anymore. if np is still in the bucket (do_subtree
 4475|       |                         * didn't adopt it) keep on plugging. otherwise
 4476|       |                         * start over, at the top of the bucket.
 4477|       |                         */
 4478|      0|                        for(onp = nbuckets[i]; onp; onp = onp->next)
  ------------------
  |  Branch (4478:48): [True: 0, False: 0]
  ------------------
 4479|      0|                            if(onp == np)
  ------------------
  |  Branch (4479:32): [True: 0, False: 0]
  ------------------
 4480|      0|                                break;
 4481|      0|                        if(NULL == onp) { /* not in the list */
  ------------------
  |  Branch (4481:28): [True: 0, False: 0]
  ------------------
 4482|      0|                            np = nbuckets[i]; /* start over */
 4483|      0|                        }
 4484|      0|		    }
 4485|      0|		}
 4486|      0|            }
 4487|      0|    }
 4488|       |
 4489|       |    /*
 4490|       |     * Report on outstanding orphans
 4491|       |     *    and link them back into the orphan list
 4492|       |     */
 4493|      0|    for (i = 0; i < NHASHSIZE; i++)
  ------------------
  |  |  529|      0|#define NHASHSIZE    128
  ------------------
  |  Branch (4493:17): [True: 0, False: 0]
  ------------------
 4494|      0|        if (nbuckets[i]) {
  ------------------
  |  Branch (4494:13): [True: 0, False: 0]
  ------------------
 4495|      0|            if (orphan_nodes)
  ------------------
  |  Branch (4495:17): [True: 0, False: 0]
  ------------------
 4496|      0|                onp = np->next = nbuckets[i];
 4497|      0|            else
 4498|      0|                onp = orphan_nodes = nbuckets[i];
 4499|      0|            nbuckets[i] = NULL;
 4500|      0|            while (onp) {
  ------------------
  |  Branch (4500:20): [True: 0, False: 0]
  ------------------
 4501|      0|                char            modbuf[256];
 4502|      0|                snmp_log(LOG_WARNING,
 4503|      0|                         "Cannot resolve OID in %s: %s ::= { %s %ld } at line %d in %s\n",
 4504|      0|                         module_name(onp->modid, modbuf),
 4505|      0|                         (onp->label ? onp->label : "<no label>"),
  ------------------
  |  Branch (4505:27): [True: 0, False: 0]
  ------------------
 4506|      0|                         (onp->parent ? onp->parent : "<no parent>"),
  ------------------
  |  Branch (4506:27): [True: 0, False: 0]
  ------------------
 4507|      0|                         onp->subid, onp->lineno, onp->filename);
 4508|      0|                np = onp;
 4509|      0|                onp = onp->next;
 4510|      0|            }
 4511|      0|        }
 4512|      0|}
netsnmp_read_module:
 4524|    270|{
 4525|    270|    int status = 0;
 4526|    270|    status = read_module_internal(name);
 4527|       |
 4528|    270|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  513|    270|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4528:9): [True: 270, False: 0]
  ------------------
 4529|    270|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4529:13): [True: 260, False: 10]
  ------------------
 4530|    260|            print_module_not_found(name);
 4531|    270|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4531:16): [True: 0, False: 0]
  ------------------
 4532|      0|        gMibError = 0;
 4533|      0|        gLoop = 1;
 4534|       |
 4535|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4536|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4537|      0|    }
 4538|       |
 4539|    270|    return tree_head;
 4540|    270|}
add_mibdir:
 5704|      2|{
 5705|      2|    const char     *oldFile = File;
 5706|      2|    int             oldLine = mibLine;
 5707|      2|    char          **filenames;
 5708|      2|    int             count = 0;
 5709|      2|    int             filename_count, i;
 5710|       |
 5711|      2|    DEBUGMSGTL(("parse-mibs", "Scanning directory %s\n", dirname));
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
 5712|       |
 5713|      2|    filename_count = scan_directory(&filenames, dirname);
 5714|       |
 5715|      2|    if (filename_count >= 0) {
  ------------------
  |  Branch (5715:9): [True: 0, False: 2]
  ------------------
 5716|      0|        for (i = 0; i < filename_count; i++) {
  ------------------
  |  Branch (5716:21): [True: 0, False: 0]
  ------------------
 5717|      0|            if (add_mibfile(filenames[i], strrchr(filenames[i], '/')) == 0)
  ------------------
  |  Branch (5717:17): [True: 0, False: 0]
  ------------------
 5718|      0|                count++;
 5719|      0|	    free(filenames[i]);
 5720|      0|        }
 5721|      0|        File = oldFile;
 5722|      0|        mibLine = oldLine;
 5723|      0|        free(filenames);
 5724|      0|        return (count);
 5725|      0|    }
 5726|      2|    else
 5727|      2|        DEBUGMSGTL(("parse-mibs","cannot open MIB directory %s\n", dirname));
  ------------------
  |  |   66|      2|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      2|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 2]
  |  |  ------------------
  ------------------
 5728|       |
 5729|      2|    return (-1);
 5730|      2|}
parse.c:name_hash:
  688|    989|{
  689|    989|    int             hash = 0;
  690|    989|    const char     *cp;
  691|       |
  692|    989|    if (!name)
  ------------------
  |  Branch (692:9): [True: 0, False: 989]
  ------------------
  693|      0|        return 0;
  694|  11.6k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (694:21): [True: 10.6k, False: 989]
  ------------------
  695|  10.6k|        hash += tolower((unsigned char)(*cp));
  ------------------
  |  Branch (695:17): [True: 0, False: 0]
  |  Branch (695:17): [True: 0, False: 0]
  |  Branch (695:17): [Folded, False: 10.6k]
  ------------------
  696|    989|    return (hash);
  697|    989|}
parse.c:build_translation_table:
 1073|      2|{
 1074|      2|    int             count;
 1075|       |
 1076|    514|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1076:21): [True: 512, False: 2]
  ------------------
 1077|    512|        switch (count) {
 1078|      2|        case OBJID:
  ------------------
  |  |  167|      2|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1078:9): [True: 2, False: 510]
  ------------------
 1079|      2|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  155|      2|#define TYPE_OBJID          1
  ------------------
 1080|      2|            break;
 1081|      2|        case OCTETSTR:
  ------------------
  |  |  168|      2|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1081:9): [True: 2, False: 510]
  ------------------
 1082|      2|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  156|      2|#define TYPE_OCTETSTR       2
  ------------------
 1083|      2|            break;
 1084|      2|        case INTEGER:
  ------------------
  |  |  169|      2|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1084:9): [True: 2, False: 510]
  ------------------
 1085|      2|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  157|      2|#define TYPE_INTEGER        3
  ------------------
 1086|      2|            break;
 1087|      2|        case NETADDR:
  ------------------
  |  |  170|      2|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1087:9): [True: 2, False: 510]
  ------------------
 1088|      2|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  158|      2|#define TYPE_NETADDR        4
  ------------------
 1089|      2|            break;
 1090|      2|        case IPADDR:
  ------------------
  |  |  171|      2|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1090:9): [True: 2, False: 510]
  ------------------
 1091|      2|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  159|      2|#define TYPE_IPADDR         5
  ------------------
 1092|      2|            break;
 1093|      2|        case COUNTER:
  ------------------
  |  |  172|      2|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1093:9): [True: 2, False: 510]
  ------------------
 1094|      2|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  160|      2|#define TYPE_COUNTER        6
  ------------------
 1095|      2|            break;
 1096|      2|        case GAUGE:
  ------------------
  |  |  173|      2|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1096:9): [True: 2, False: 510]
  ------------------
 1097|      2|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  161|      2|#define TYPE_GAUGE          7
  ------------------
 1098|      2|            break;
 1099|      2|        case TIMETICKS:
  ------------------
  |  |  174|      2|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1099:9): [True: 2, False: 510]
  ------------------
 1100|      2|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  162|      2|#define TYPE_TIMETICKS      8
  ------------------
 1101|      2|            break;
 1102|      2|        case KW_OPAQUE:
  ------------------
  |  |  175|      2|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1102:9): [True: 2, False: 510]
  ------------------
 1103|      2|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  163|      2|#define TYPE_OPAQUE         9
  ------------------
 1104|      2|            break;
 1105|      2|        case NUL:
  ------------------
  |  |  176|      2|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1105:9): [True: 2, False: 510]
  ------------------
 1106|      2|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  164|      2|#define TYPE_NULL           10
  ------------------
 1107|      2|            break;
 1108|      2|        case COUNTER64:
  ------------------
  |  |  211|      2|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1108:9): [True: 2, False: 510]
  ------------------
 1109|      2|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  165|      2|#define TYPE_COUNTER64      11
  ------------------
 1110|      2|            break;
 1111|      2|        case BITSTRING:
  ------------------
  |  |  209|      2|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1111:9): [True: 2, False: 510]
  ------------------
 1112|      2|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  166|      2|#define TYPE_BITSTRING      12
  ------------------
 1113|      2|            break;
 1114|      2|        case NSAPADDRESS:
  ------------------
  |  |  210|      2|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1114:9): [True: 2, False: 510]
  ------------------
 1115|      2|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  167|      2|#define TYPE_NSAPADDRESS    13
  ------------------
 1116|      2|            break;
 1117|      2|        case INTEGER32:
  ------------------
  |  |  274|      2|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1117:9): [True: 2, False: 510]
  ------------------
 1118|      2|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  170|      2|#define TYPE_INTEGER32      16
  ------------------
 1119|      2|            break;
 1120|      2|        case UINTEGER32:
  ------------------
  |  |  224|      2|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1120:9): [True: 2, False: 510]
  ------------------
 1121|      2|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  168|      2|#define TYPE_UINTEGER       14
  ------------------
 1122|      2|            break;
 1123|      2|        case UNSIGNED32:
  ------------------
  |  |  273|      2|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      2|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1123:9): [True: 2, False: 510]
  ------------------
 1124|      2|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  169|      2|#define TYPE_UNSIGNED32     15
  ------------------
 1125|      2|            break;
 1126|      2|        case TRAPTYPE:
  ------------------
  |  |  229|      2|#define TRAPTYPE    61
  ------------------
  |  Branch (1126:9): [True: 2, False: 510]
  ------------------
 1127|      2|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  174|      2|#define TYPE_TRAPTYPE	    20
  ------------------
 1128|      2|            break;
 1129|      2|        case NOTIFTYPE:
  ------------------
  |  |  213|      2|#define NOTIFTYPE   45
  ------------------
  |  Branch (1129:9): [True: 2, False: 510]
  ------------------
 1130|      2|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  175|      2|#define TYPE_NOTIFTYPE      21
  ------------------
 1131|      2|            break;
 1132|      2|        case NOTIFGROUP:
  ------------------
  |  |  258|      2|#define NOTIFGROUP  88
  ------------------
  |  Branch (1132:9): [True: 2, False: 510]
  ------------------
 1133|      2|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  177|      2|#define TYPE_NOTIFGROUP	    23
  ------------------
 1134|      2|            break;
 1135|      2|        case OBJGROUP:
  ------------------
  |  |  212|      2|#define OBJGROUP    44
  ------------------
  |  Branch (1135:9): [True: 2, False: 510]
  ------------------
 1136|      2|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  176|      2|#define TYPE_OBJGROUP	    22
  ------------------
 1137|      2|            break;
 1138|      2|        case MODULEIDENTITY:
  ------------------
  |  |  220|      2|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1138:9): [True: 2, False: 510]
  ------------------
 1139|      2|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  178|      2|#define TYPE_MODID	    24
  ------------------
 1140|      2|            break;
 1141|      2|        case OBJIDENTITY:
  ------------------
  |  |  275|      2|#define OBJIDENTITY	106
  ------------------
  |  Branch (1141:9): [True: 2, False: 510]
  ------------------
 1142|      2|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  181|      2|#define TYPE_OBJIDENTITY    27
  ------------------
 1143|      2|            break;
 1144|      2|        case AGENTCAP:
  ------------------
  |  |  243|      2|#define AGENTCAP    73
  ------------------
  |  Branch (1144:9): [True: 2, False: 510]
  ------------------
 1145|      2|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  179|      2|#define TYPE_AGENTCAP       25
  ------------------
 1146|      2|            break;
 1147|      2|        case COMPLIANCE:
  ------------------
  |  |  215|      2|#define COMPLIANCE  47
  ------------------
  |  Branch (1147:9): [True: 2, False: 510]
  ------------------
 1148|      2|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  180|      2|#define TYPE_MODCOMP        26
  ------------------
 1149|      2|            break;
 1150|    464|        default:
  ------------------
  |  Branch (1150:9): [True: 464, False: 48]
  ------------------
 1151|    464|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  154|    464|#define TYPE_OTHER          0
  ------------------
 1152|    464|            break;
 1153|    512|        }
 1154|    512|    }
 1155|      2|}
parse.c:init_tree_roots:
 1159|      2|{
 1160|      2|    struct tree    *tp, *lasttp;
 1161|      2|    int             base_modid;
 1162|      2|    int             hash;
 1163|       |
 1164|      2|    base_modid = which_module("SNMPv2-SMI");
 1165|      2|    if (base_modid == -1)
  ------------------
  |  Branch (1165:9): [True: 2, False: 0]
  ------------------
 1166|      2|        base_modid = which_module("RFC1155-SMI");
 1167|      2|    if (base_modid == -1)
  ------------------
  |  Branch (1167:9): [True: 2, False: 0]
  ------------------
 1168|      2|        base_modid = which_module("RFC1213-MIB");
 1169|       |
 1170|       |    /*
 1171|       |     * build root node 
 1172|       |     */
 1173|      2|    tp = calloc(1, sizeof(struct tree));
 1174|      2|    if (tp == NULL)
  ------------------
  |  Branch (1174:9): [True: 0, False: 2]
  ------------------
 1175|      0|        return;
 1176|      2|    tp->label = strdup("joint-iso-ccitt");
 1177|      2|    tp->modid = base_modid;
 1178|      2|    tp->number_modules = 1;
 1179|      2|    tp->module_list = &(tp->modid);
 1180|      2|    tp->subid = 2;
 1181|      2|    tp->tc_index = -1;
 1182|      2|    set_function(tp);           /* from mib.c */
 1183|      2|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      2|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      2|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1184|      2|    tp->next = tbuckets[hash];
 1185|      2|    tbuckets[hash] = tp;
 1186|      2|    lasttp = tp;
 1187|      2|    root_imports[0].label = strdup(tp->label);
 1188|      2|    root_imports[0].modid = base_modid;
 1189|       |
 1190|       |    /*
 1191|       |     * build root node 
 1192|       |     */
 1193|      2|    tp = calloc(1, sizeof(struct tree));
 1194|      2|    if (tp == NULL)
  ------------------
  |  Branch (1194:9): [True: 0, False: 2]
  ------------------
 1195|      0|        return;
 1196|      2|    tp->next_peer = lasttp;
 1197|      2|    tp->label = strdup("ccitt");
 1198|      2|    tp->modid = base_modid;
 1199|      2|    tp->number_modules = 1;
 1200|      2|    tp->module_list = &(tp->modid);
 1201|      2|    tp->subid = 0;
 1202|      2|    tp->tc_index = -1;
 1203|      2|    set_function(tp);           /* from mib.c */
 1204|      2|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      2|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      2|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1205|      2|    tp->next = tbuckets[hash];
 1206|      2|    tbuckets[hash] = tp;
 1207|      2|    lasttp = tp;
 1208|      2|    root_imports[1].label = strdup(tp->label);
 1209|      2|    root_imports[1].modid = base_modid;
 1210|       |
 1211|       |    /*
 1212|       |     * build root node 
 1213|       |     */
 1214|      2|    tp = calloc(1, sizeof(struct tree));
 1215|      2|    if (tp == NULL)
  ------------------
  |  Branch (1215:9): [True: 0, False: 2]
  ------------------
 1216|      0|        return;
 1217|      2|    tp->next_peer = lasttp;
 1218|      2|    tp->label = strdup("iso");
 1219|      2|    tp->modid = base_modid;
 1220|      2|    tp->number_modules = 1;
 1221|      2|    tp->module_list = &(tp->modid);
 1222|      2|    tp->subid = 1;
 1223|      2|    tp->tc_index = -1;
 1224|      2|    set_function(tp);           /* from mib.c */
 1225|      2|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      2|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      2|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1226|      2|    tp->next = tbuckets[hash];
 1227|      2|    tbuckets[hash] = tp;
 1228|      2|    lasttp = tp;
 1229|      2|    root_imports[2].label = strdup(tp->label);
 1230|      2|    root_imports[2].modid = base_modid;
 1231|       |
 1232|      2|    tree_head = tp;
 1233|      2|}
parse.c:regex_too_complex:
 1339|    725|{
 1340|    725|    const char     *const start = key;
 1341|    725|    int             depth = 0;
 1342|    725|    int             plus_count = 0;
 1343|    725|    int             quantifiable = 0;
 1344|    725|    const char     *end;
 1345|       |
 1346|    725|    if (memchr(key, '\0', MAX_REGEX_LEN + 1) == NULL)
  ------------------
  |  | 1305|    725|#define MAX_REGEX_LEN           256
  ------------------
  |  Branch (1346:9): [True: 1, False: 724]
  ------------------
 1347|      1|        return 1;
 1348|       |
 1349|  11.8k|    for (; *key; key++) {
  ------------------
  |  Branch (1349:12): [True: 11.3k, False: 529]
  ------------------
 1350|  11.3k|        switch (*key) {
 1351|    205|        case '\\':
  ------------------
  |  Branch (1351:9): [True: 205, False: 11.1k]
  ------------------
 1352|    205|            if (!key[1])
  ------------------
  |  Branch (1352:17): [True: 1, False: 204]
  ------------------
 1353|      1|                return 1;
 1354|    204|            key++;
 1355|    204|            if (isalnum((unsigned char)*key) || strchr("<>`'", *key))
  ------------------
  |  Branch (1355:17): [True: 2, False: 202]
  |  Branch (1355:49): [True: 1, False: 201]
  ------------------
 1356|      3|                return 1;
 1357|    201|            quantifiable = 1;
 1358|    201|            break;
 1359|    390|        case '[':
  ------------------
  |  Branch (1359:9): [True: 390, False: 10.9k]
  ------------------
 1360|    390|            end = skip_bracket_expr(key);
 1361|    390|            if (!end)
  ------------------
  |  Branch (1361:17): [True: 143, False: 247]
  ------------------
 1362|    143|                return 1;
 1363|    247|            key = end;
 1364|    247|            quantifiable = 1;
 1365|    247|            break;
 1366|    582|        case '(':
  ------------------
  |  Branch (1366:9): [True: 582, False: 10.7k]
  ------------------
 1367|    582|            if (++depth > MAX_REGEX_NESTING_DEPTH)
  ------------------
  |  | 1306|    582|#define MAX_REGEX_NESTING_DEPTH 32
  ------------------
  |  Branch (1367:17): [True: 1, False: 581]
  ------------------
 1368|      1|                return 1;
 1369|    581|            quantifiable = 0;
 1370|    581|            break;
 1371|    494|        case ')':
  ------------------
  |  Branch (1371:9): [True: 494, False: 10.8k]
  ------------------
 1372|    494|            if (depth > 0)
  ------------------
  |  Branch (1372:17): [True: 295, False: 199]
  ------------------
 1373|    295|                depth--;
 1374|    494|            quantifiable = 0;
 1375|    494|            break;
 1376|     50|        case '+':
  ------------------
  |  Branch (1376:9): [True: 50, False: 11.3k]
  ------------------
 1377|     50|            if (++plus_count > MAX_REGEX_PLUS)
  ------------------
  |  | 1307|     50|#define MAX_REGEX_PLUS          8
  ------------------
  |  Branch (1377:17): [True: 1, False: 49]
  ------------------
 1378|      1|                return 1;
 1379|       |            /* FALL THROUGH */
 1380|    407|        case '*':
  ------------------
  |  Branch (1380:9): [True: 358, False: 11.0k]
  ------------------
 1381|    698|        case '?':
  ------------------
  |  Branch (1381:9): [True: 291, False: 11.0k]
  ------------------
 1382|    698|            if (!quantifiable)
  ------------------
  |  Branch (1382:17): [True: 28, False: 670]
  ------------------
 1383|     28|                return 1;
 1384|    670|            quantifiable = 0;
 1385|    670|            break;
 1386|      5|        case '{':
  ------------------
  |  Branch (1386:9): [True: 5, False: 11.3k]
  ------------------
 1387|      5|            return 1;
 1388|      4|        case '^':
  ------------------
  |  Branch (1388:9): [True: 4, False: 11.3k]
  ------------------
 1389|      4|            if (key != start)
  ------------------
  |  Branch (1389:17): [True: 3, False: 1]
  ------------------
 1390|      3|                return 1;
 1391|      1|            quantifiable = 0;
 1392|      1|            break;
 1393|     13|        case '$':
  ------------------
  |  Branch (1393:9): [True: 13, False: 11.3k]
  ------------------
 1394|     13|            if (key[1])
  ------------------
  |  Branch (1394:17): [True: 10, False: 3]
  ------------------
 1395|     10|                return 1;
 1396|      3|            quantifiable = 0;
 1397|      3|            break;
 1398|    221|        case '|':
  ------------------
  |  Branch (1398:9): [True: 221, False: 11.1k]
  ------------------
 1399|    221|            quantifiable = 0;
 1400|    221|            break;
 1401|  8.75k|        default:
  ------------------
  |  Branch (1401:9): [True: 8.75k, False: 2.61k]
  ------------------
 1402|  8.75k|            quantifiable = 1;
 1403|  8.75k|            break;
 1404|  11.3k|        }
 1405|  11.3k|    }
 1406|    529|    return 0;
 1407|    724|}
parse.c:skip_bracket_expr:
 1315|    390|{
 1316|    390|    p++;
 1317|    390|    if (*p == '^')
  ------------------
  |  Branch (1317:9): [True: 66, False: 324]
  ------------------
 1318|     66|        p++;
 1319|    390|    if (*p == ']')
  ------------------
  |  Branch (1319:9): [True: 84, False: 306]
  ------------------
 1320|     84|        p++;
 1321|  1.40k|    for (; *p; p++) {
  ------------------
  |  Branch (1321:12): [True: 1.31k, False: 92]
  ------------------
 1322|  1.31k|        if (*p == ']')
  ------------------
  |  Branch (1322:13): [True: 247, False: 1.06k]
  ------------------
 1323|    247|            return p;
 1324|  1.06k|        if (*p == '[' && (p[1] == ':' || p[1] == '=' || p[1] == '.')) {
  ------------------
  |  Branch (1324:13): [True: 485, False: 581]
  |  Branch (1324:27): [True: 0, False: 485]
  |  Branch (1324:42): [True: 136, False: 349]
  |  Branch (1324:57): [True: 100, False: 249]
  ------------------
 1325|    236|            const char      delim = p[1];
 1326|       |
 1327|    655|            for (p += 2; *p && !(p[0] == delim && p[1] == ']'); p++)
  ------------------
  |  Branch (1327:26): [True: 604, False: 51]
  |  Branch (1327:34): [True: 389, False: 215]
  |  Branch (1327:51): [True: 185, False: 204]
  ------------------
 1328|    419|                ;
 1329|    236|            if (!*p)
  ------------------
  |  Branch (1329:17): [True: 51, False: 185]
  ------------------
 1330|     51|                return NULL;
 1331|    185|            p++;
 1332|    185|        }
 1333|  1.06k|    }
 1334|     92|    return NULL;
 1335|    390|}
parse.c:find_best_tree_node_r:
 1478|    509|{
 1479|    509|    struct tree    *tp, *best_so_far = NULL, *retptr;
 1480|    509|    u_int           old_match = MAX_BAD, new_match = MAX_BAD;
  ------------------
  |  | 1273|    509|#define MAX_BAD 0xffffff
  ------------------
                  u_int           old_match = MAX_BAD, new_match = MAX_BAD;
  ------------------
  |  | 1273|    509|#define MAX_BAD 0xffffff
  ------------------
 1481|       |
 1482|  1.91k|    for (tp = tree_top; tp; tp = tp->next_peer) {
  ------------------
  |  Branch (1482:25): [True: 1.46k, False: 455]
  ------------------
 1483|  1.46k|        if (!tp->reported && tp->label)
  ------------------
  |  Branch (1483:13): [True: 1.46k, False: 0]
  |  Branch (1483:30): [True: 1.46k, False: 0]
  ------------------
 1484|  1.46k|#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
 1485|  1.46k|            new_match = compute_match(tp->label, parsetree);
 1486|       |#else
 1487|       |            new_match = compute_match(tp->label, pattrn);
 1488|       |#endif
 1489|  1.46k|        tp->reported = 1;
 1490|       |
 1491|  1.46k|        if (new_match < old_match) {
  ------------------
  |  Branch (1491:13): [True: 83, False: 1.38k]
  ------------------
 1492|     83|            best_so_far = tp;
 1493|     83|            old_match = new_match;
 1494|     83|        }
 1495|  1.46k|        if (new_match == 0)
  ------------------
  |  Branch (1495:13): [True: 54, False: 1.40k]
  ------------------
 1496|     54|            break;              /* this is the best result we can get */
 1497|  1.40k|        if (tp->child_list) {
  ------------------
  |  Branch (1497:13): [True: 0, False: 1.40k]
  ------------------
 1498|      0|            retptr =
 1499|      0|#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
 1500|      0|                find_best_tree_node_r(parsetree, tp->child_list, &new_match);
 1501|       |#else
 1502|       |                find_best_tree_node_r(pattrn, tp->child_list, &new_match);
 1503|       |#endif
 1504|      0|            if (new_match < old_match) {
  ------------------
  |  Branch (1504:17): [True: 0, False: 0]
  ------------------
 1505|      0|                best_so_far = retptr;
 1506|      0|                old_match = new_match;
 1507|      0|            }
 1508|      0|            if (new_match == 0)
  ------------------
  |  Branch (1508:17): [True: 0, False: 0]
  ------------------
 1509|      0|                break;          /* this is the best result we can get */
 1510|      0|        }
 1511|  1.40k|    }
 1512|    509|    if (match)
  ------------------
  |  Branch (1512:9): [True: 0, False: 509]
  ------------------
 1513|      0|        *match = old_match;
 1514|    509|    return (best_so_far);
 1515|    509|}
parse.c:compute_match:
 1411|  1.46k|{
 1412|  1.46k|    regmatch_t      pmatch;
 1413|       |
 1414|  1.46k|    if (regexec(parsetree, search_base, 1, &pmatch, 0) == 0)
  ------------------
  |  Branch (1414:9): [True: 91, False: 1.37k]
  ------------------
 1415|     91|        return pmatch.rm_so;
 1416|  1.37k|    return MAX_BAD;
  ------------------
  |  | 1273|  1.37k|#define MAX_BAD 0xffffff
  ------------------
 1417|  1.46k|}
parse.c:read_module_internal:
 4432|    270|{
 4433|    270|    struct module  *mp;
 4434|       |
 4435|    270|    netsnmp_init_mib_internals();
 4436|       |
 4437|    270|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (4437:28): [True: 0, False: 270]
  ------------------
 4438|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1238|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (4438:13): [True: 0, False: 0]
  ------------------
 4439|      0|            return read_from_file(mp, name);
 4440|       |
 4441|    270|    return MODULE_NOT_FOUND;
  ------------------
  |  |  513|    270|#define MODULE_NOT_FOUND	0
  ------------------
 4442|    270|}
parse.c:print_error:
  781|    250|{
  782|    250|    erroneousMibs++;
  783|    250|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    250|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (783:9): [True: 250, False: 0]
  ------------------
  784|    250|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|    250|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  785|    250|	return;
  786|      0|    DEBUGMSGTL(("parse-mibs", "\n"));
  ------------------
  |  |   66|      0|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|      0|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  164|      0|#define __DBGMSGTL(x)    __DBGTRACE, debugmsgtoken x, debugmsg x
  |  |  |  |  ------------------
  |  |  |  |  |  |  154|      0|#define __DBGTRACE       __DBGMSGT(("trace","%s(): %s, %d:\n",\
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  147|      0|#define __DBGMSGT(x)     debugmsgtoken x,  debugmsg x
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  155|      0|				NETSNMP_FUNCTION,__FILE__,__LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (66:70): [Folded, False: 0]
  |  |  ------------------
  ------------------
  787|      0|    if (type == ENDOFFILE)
  ------------------
  |  |  163|      0|#define ENDOFFILE   0
  ------------------
  |  Branch (787:9): [True: 0, False: 0]
  ------------------
  788|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  789|      0|                 File);
  790|      0|    else if (token && *token)
  ------------------
  |  Branch (790:14): [True: 0, False: 0]
  |  Branch (790:23): [True: 0, False: 0]
  ------------------
  791|      0|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  792|      0|                 mibLine, File);
  793|      0|    else
  794|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  795|      0|}
parse.c:read_module_replacements:
 4312|    270|{
 4313|    270|    struct module_compatability *mcp;
 4314|       |
 4315|  6.05k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (4315:33): [True: 5.79k, False: 260]
  ------------------
 4316|  5.79k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1238|  5.79k|#define	label_compare	strcmp
  ------------------
  |  Branch (4316:13): [True: 10, False: 5.78k]
  ------------------
 4317|     10|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     10|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (4317:17): [True: 0, False: 10]
  ------------------
 4318|     10|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|     10|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 4319|      0|                snmp_log(LOG_WARNING,
 4320|      0|                         "Loading replacement module %s for %s (%s)\n",
 4321|      0|                         mcp->new_module, name, File);
 4322|      0|	    }
 4323|     10|            (void) netsnmp_read_module(mcp->new_module);
 4324|     10|            return 1;
 4325|     10|        }
 4326|  5.79k|    }
 4327|    260|    return 0;
 4328|    270|}
parse.c:print_module_not_found:
  799|    260|{
  800|    260|    if (first_err_module) {
  ------------------
  |  Branch (800:9): [True: 2, False: 258]
  ------------------
  801|      2|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  802|      2|                           netsnmp_get_mib_directory());
  803|      2|        first_err_module = 0;
  804|      2|    }
  805|    260|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (805:9): [True: 2, False: 258]
  |  Branch (805:29): [True: 248, False: 10]
  ------------------
  806|    250|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  162|    250|#define CONTINUE    -1
  ------------------
  807|    260|    if (last_err_module)
  ------------------
  |  Branch (807:9): [True: 258, False: 2]
  ------------------
  808|    258|        free(last_err_module);
  809|    260|    last_err_module = strdup(cp);
  810|    260|}
parse.c:scan_directory:
 5634|      2|{
 5635|      2|    DIR            *dir, *dir2;
 5636|      2|    struct dirent  *file;
 5637|      2|    char          **filenames = NULL;
 5638|      2|    int             fname_len, i, filename_count = 0, array_size = 0;
 5639|      2|    char           *tmpstr;
 5640|       |
 5641|      2|    *result = NULL;
 5642|       |
 5643|      2|    dir = opendir(dirname);
 5644|      2|    if (!dir)
  ------------------
  |  Branch (5644:9): [True: 2, False: 0]
  ------------------
 5645|      2|        return -1;
 5646|       |
 5647|      0|    while ((file = readdir(dir))) {
  ------------------
  |  Branch (5647:12): [True: 0, False: 0]
  ------------------
 5648|       |        /*
 5649|       |         * Only parse file names that don't begin with a '.'
 5650|       |         * Also skip files ending in '~', or starting/ending
 5651|       |         * with '#' which are typically editor backup files.
 5652|       |         */
 5653|      0|        fname_len = strlen(file->d_name);
 5654|      0|        if (fname_len > 0 && file->d_name[0] != '.'
  ------------------
  |  Branch (5654:13): [True: 0, False: 0]
  |  Branch (5654:30): [True: 0, False: 0]
  ------------------
 5655|      0|            && file->d_name[0] != '#'
  ------------------
  |  Branch (5655:16): [True: 0, False: 0]
  ------------------
 5656|      0|            && file->d_name[fname_len-1] != '#'
  ------------------
  |  Branch (5656:16): [True: 0, False: 0]
  ------------------
 5657|      0|            && file->d_name[fname_len-1] != '~') {
  ------------------
  |  Branch (5657:16): [True: 0, False: 0]
  ------------------
 5658|      0|            if (asprintf(&tmpstr, "%s/%s", dirname, file->d_name) < 0)
  ------------------
  |  Branch (5658:17): [True: 0, False: 0]
  ------------------
 5659|      0|                continue;
 5660|      0|            dir2 = opendir(tmpstr);
 5661|      0|            if (dir2) {
  ------------------
  |  Branch (5661:17): [True: 0, False: 0]
  ------------------
 5662|       |                /* file is a directory, don't read it */
 5663|      0|                closedir(dir2);
 5664|      0|            } else {
 5665|      0|                if (filename_count >= array_size) {
  ------------------
  |  Branch (5665:21): [True: 0, False: 0]
  ------------------
 5666|      0|                    char **new_filenames;
 5667|       |
 5668|      0|                    array_size = (array_size + 16) * 2;
 5669|      0|                    new_filenames = realloc(filenames,
 5670|      0|                                        array_size * sizeof(filenames[0]));
 5671|      0|                    if (!new_filenames) {
  ------------------
  |  Branch (5671:25): [True: 0, False: 0]
  ------------------
 5672|      0|                        free(tmpstr);
 5673|      0|                        for (i = 0; i < filename_count; i++)
  ------------------
  |  Branch (5673:37): [True: 0, False: 0]
  ------------------
 5674|      0|                            free(filenames[i]);
 5675|      0|                        free(filenames);
 5676|      0|                        closedir(dir);
 5677|      0|                        return -1;
 5678|      0|                    }
 5679|      0|                    filenames = new_filenames;
 5680|      0|                }
 5681|      0|                filenames[filename_count++] = tmpstr;
 5682|      0|                tmpstr = NULL;
 5683|      0|            }
 5684|      0|            free(tmpstr);
 5685|      0|        }
 5686|      0|    }
 5687|      0|    closedir(dir);
 5688|       |
 5689|      0|    if (filenames)
  ------------------
  |  Branch (5689:9): [True: 0, False: 0]
  ------------------
 5690|      0|        qsort(filenames, filename_count, sizeof(filenames[0]), elemcmp);
 5691|      0|    *result = filenames;
 5692|       |
 5693|      0|    return filename_count;
 5694|      0|}

snmp_set_detail:
  529|    820|{
  530|    820|    if (detail_string != NULL) {
  ------------------
  |  Branch (530:9): [True: 820, False: 0]
  ------------------
  531|    820|        strlcpy(snmp_detail, detail_string, sizeof(snmp_detail));
  532|    820|        snmp_detail_f = 1;
  533|    820|    }
  534|    820|}

snmp_get_do_debugging:
  551|    928|{
  552|    928|    return dodebug;
  553|    928|}

netsnmp_set_line_buffering:
  187|      2|{
  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|      2|    setvbuf(stream, NULL, _IOLBF, BUFSIZ);
  201|      2|#endif
  202|      2|}
log_handler_stdouterr:
 1103|      2|{
 1104|      2|    static int      newline = 1;	 /* MTCRITICAL_RESOURCE */
 1105|      2|    const char     *newline_ptr;
 1106|      2|    char            sbuf[40];
 1107|       |
 1108|      2|    if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|      2|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (1108:9): [True: 0, False: 2]
  ------------------
 1109|      2|                               NETSNMP_DS_LIB_LOG_TIMESTAMP) && newline) {
  ------------------
  |  |   64|      2|#define NETSNMP_DS_LIB_LOG_TIMESTAMP       5
  ------------------
  |  Branch (1109:65): [True: 0, False: 0]
  ------------------
 1110|      0|        snprintf_stamp(NULL, sbuf, sizeof(sbuf));
 1111|      2|    } else {
 1112|      2|        strcpy(sbuf, "");
 1113|      2|    }
 1114|       |    /*
 1115|       |     * Remember whether or not the current line ends with a newline for the
 1116|       |     * next call of log_handler_stdouterr().
 1117|       |     */
 1118|      2|    newline_ptr = strrchr(str, '\n');
 1119|      2|    newline = newline_ptr && newline_ptr[1] == 0;
  ------------------
  |  Branch (1119:15): [True: 2, False: 0]
  |  Branch (1119:30): [True: 2, False: 0]
  ------------------
 1120|       |
 1121|      2|    if (logh->imagic)
  ------------------
  |  Branch (1121:9): [True: 0, False: 2]
  ------------------
 1122|      0|       printf(         "%s%s", sbuf, str);
 1123|      2|    else
 1124|      2|       fprintf(stderr, "%s%s", sbuf, str);
 1125|       |
 1126|      2|    return 1;
 1127|      2|}
snmp_log_string:
 1294|      2|{
 1295|      2|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1296|      2|    static int stderr_enabled = 0;
 1297|      2|    static netsnmp_log_handler lh = { 1, 0, 0, 0, "stderr",
 1298|      2|                                      log_handler_stdouterr, 0, NULL,  NULL,
 1299|      2|                                      NULL };
 1300|      2|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1301|      2|    netsnmp_log_handler *logh;
 1302|       |
 1303|       |    /*
 1304|       |     * We've got to be able to log messages *somewhere*!
 1305|       |     * If you don't want stderr logging, then enable something else.
 1306|       |     */
 1307|      2|    if (0 == logh_enabled) {
  ------------------
  |  Branch (1307:9): [True: 2, False: 0]
  ------------------
 1308|      2|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1309|      2|        if (!stderr_enabled) {
  ------------------
  |  Branch (1309:13): [True: 2, False: 0]
  ------------------
 1310|      2|            ++stderr_enabled;
 1311|      2|            netsnmp_set_line_buffering(stderr);
 1312|      2|        }
 1313|      2|        log_handler_stdouterr( &lh, priority, str );
 1314|      2|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1315|       |
 1316|      2|        return;
 1317|      2|    }
 1318|      0|#ifndef NETSNMP_FEATURE_REMOVE_LOGGING_STDIO
 1319|      0|    else if (stderr_enabled) {
  ------------------
  |  Branch (1319:14): [True: 0, False: 0]
  ------------------
 1320|      0|        stderr_enabled = 0;
 1321|      0|        log_handler_stdouterr( &lh, LOG_INFO,
 1322|      0|                               "Log handling defined - disabling stderr\n" );
 1323|      0|    }
 1324|      0|#endif /* NETSNMP_FEATURE_REMOVE_LOGGING_STDIO */
 1325|       |        
 1326|       |
 1327|       |    /*
 1328|       |     * Start at the given priority, and work "upwards"....
 1329|       |     */
 1330|      0|    if (priority < LOG_EMERG)
  ------------------
  |  Branch (1330:9): [True: 0, False: 0]
  ------------------
 1331|      0|        priority = LOG_EMERG;
 1332|      0|    else if (priority > LOG_DEBUG)
  ------------------
  |  Branch (1332:14): [True: 0, False: 0]
  ------------------
 1333|      0|        priority = LOG_DEBUG;
 1334|      0|    logh = logh_priorities[priority];
 1335|      0|    for ( ; logh; logh = logh->next ) {
  ------------------
  |  Branch (1335:13): [True: 0, False: 0]
  ------------------
 1336|       |        /*
 1337|       |         * ... but skipping any handlers with a "maximum priority"
 1338|       |         *     that we have already exceeded. And don't forget to
 1339|       |         *     ensure this logging is turned on (see snmp_disable_stderrlog
 1340|       |         *     and its cohorts).
 1341|       |         */
 1342|      0|        if (logh->enabled && priority >= logh->pri_max)
  ------------------
  |  Branch (1342:13): [True: 0, False: 0]
  |  Branch (1342:30): [True: 0, False: 0]
  ------------------
 1343|      0|            logh->handler( logh, priority, str );
 1344|      0|    }
 1345|      0|}
snmp_vlog:
 1383|      2|{
 1384|      2|    char           *buffer = NULL;
 1385|      2|    int             length;
 1386|       |
 1387|      2|    length = vasprintf(&buffer, format, ap);
 1388|      2|    if (length < 0) {
  ------------------
  |  Branch (1388:9): [True: 0, False: 2]
  ------------------
 1389|      0|        snmp_log_string(LOG_ERR, "Could not format log-string\n");
 1390|      0|        return -1;
 1391|      0|    }
 1392|       |
 1393|      2|    snmp_log_string(priority, buffer);
 1394|      2|    free(buffer);
 1395|      2|    return 0;
 1396|      2|}
snmp_log:
 1407|      2|{
 1408|      2|    va_list         ap;
 1409|      2|    int             ret;
 1410|      2|    va_start(ap, format);
 1411|      2|    ret = snmp_vlog(priority, format, ap);
 1412|       |    va_end(ap);
 1413|      2|    return (ret);
 1414|      2|}

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

LLVMFuzzerInitialize:
   38|      2|int LLVMFuzzerInitialize(int *argc, char ***argv) {
   39|      2|    char path[PATH_MAX];
   40|      2|    char mibdirs[PATH_MAX];
   41|      2|    char *dir;
   42|       |
   43|      2|    if (getenv("NETSNMP_DEBUGGING") != NULL) {
  ------------------
  |  Branch (43:9): [True: 0, False: 2]
  ------------------
   44|       |        /*
   45|       |         * Turn on all debugging, to help understand what
   46|       |         * bits of the parser are running.
   47|       |         */
   48|      0|        snmp_enable_stderrlog();
   49|      0|        snmp_set_do_debugging(1);
   50|      0|        debug_register_tokens("");
   51|      0|    }
   52|       |
   53|      2|    strlcpy(path, (*argv)[0], sizeof(path));
   54|      2|    dir = dirname(path);
   55|      2|    snprintf(mibdirs, sizeof(mibdirs), "%s/../../mibs", dir);
   56|      2|    netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |   48|      2|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
                  netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_MIBDIRS,
  ------------------
  |  |  162|      2|#define NETSNMP_DS_LIB_MIBDIRS           11
  ------------------
   57|      2|                          mibdirs);
   58|      2|    netsnmp_init_mib();
   59|       |
   60|      2|    return 0;
   61|      2|}
LLVMFuzzerTestOneInput:
   67|  1.03k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   68|  1.03k|    oid *root = malloc(MAX_OID_LEN * sizeof(oid));
  ------------------
  |  |  120|  1.03k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
   69|  1.03k|    size_t rootlen = MAX_OID_LEN;
  ------------------
  |  |  120|  1.03k|#define MAX_OID_LEN	    128 /* max subid's in an oid */
  ------------------
   70|  1.03k|    char *input;
   71|       |
   72|  1.03k|    input = strndup((const char *)data, size);
   73|  1.03k|    if (root && input)
  ------------------
  |  Branch (73:9): [True: 1.03k, False: 0]
  |  Branch (73:17): [True: 1.03k, False: 0]
  ------------------
   74|  1.03k|        snmp_parse_oid((const char *)input, root, &rootlen);
   75|  1.03k|    free(root);
   76|  1.03k|    free(input);
   77|  1.03k|    return 0; 
   78|  1.03k|}

