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

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

netsnmp_init_mib_internals:
  700|    199|{
  701|    199|    register struct tok *tp;
  702|    199|    register int    b, i;
  703|    199|    int             max_modc;
  704|       |
  705|    199|    if (tree_head)
  ------------------
  |  Branch (705:9): [True: 198, False: 1]
  ------------------
  706|    198|        return;
  707|       |
  708|       |    /*
  709|       |     * Set up hash list of pre-defined tokens
  710|       |     */
  711|      1|    memset(buckets, 0, sizeof(buckets));
  712|     93|    for (tp = tokens; tp->name; tp++) {
  ------------------
  |  Branch (712:23): [True: 92, False: 1]
  ------------------
  713|     92|        tp->hash = name_hash(tp->name);
  714|     92|        b = BUCKET(tp->hash);
  ------------------
  |  |  527|     92|#define BUCKET(x)       (x & (HASHSIZE-1))
  |  |  ------------------
  |  |  |  |  526|     92|#define HASHSIZE        32
  |  |  ------------------
  ------------------
  715|     92|        if (buckets[b])
  ------------------
  |  Branch (715:13): [True: 60, False: 32]
  ------------------
  716|     60|            tp->next = buckets[b];      /* BUG ??? */
  717|     92|        buckets[b] = tp;
  718|     92|    }
  719|       |
  720|       |    /*
  721|       |     * Initialise other internal structures
  722|       |     */
  723|       |
  724|      1|    max_modc = sizeof(module_map) / sizeof(module_map[0]) - 1;
  725|     22|    for (i = 0; i < max_modc; ++i)
  ------------------
  |  Branch (725:17): [True: 21, False: 1]
  ------------------
  726|     21|        module_map[i].next = &(module_map[i + 1]);
  727|      1|    module_map[max_modc].next = NULL;
  728|      1|    module_map_head = module_map;
  729|       |
  730|      1|    memset(nbuckets, 0, sizeof(nbuckets));
  731|      1|    memset(tbuckets, 0, sizeof(tbuckets));
  732|      1|    tc_alloc = TC_INCR;
  ------------------
  |  |  134|      1|#define TC_INCR 100
  ------------------
  733|      1|    tclist = calloc(tc_alloc, sizeof(struct tc));
  734|      1|    build_translation_table();
  735|      1|    init_tree_roots();          /* Set up initial roots */
  736|       |    /*
  737|       |     * Relies on 'add_mibdir' having set up the modules 
  738|       |     */
  739|      1|}
find_tree_node:
 1241|    366|{
 1242|    366|    struct tree    *tp, *headtp;
 1243|    366|    int             count, *int_p;
 1244|       |
 1245|    366|    if (!name || !*name)
  ------------------
  |  Branch (1245:9): [True: 0, False: 366]
  |  Branch (1245:18): [True: 2, False: 364]
  ------------------
 1246|      2|        return (NULL);
 1247|       |
 1248|    364|    headtp = tbuckets[NBUCKET(name_hash(name))];
  ------------------
  |  |  530|    364|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|    364|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1249|    488|    for (tp = headtp; tp; tp = tp->next) {
  ------------------
  |  Branch (1249:23): [True: 154, False: 334]
  ------------------
 1250|    154|        if (tp->label && !label_compare(tp->label, name)) {
  ------------------
  |  | 1235|    154|#define	label_compare	strcmp
  ------------------
  |  Branch (1250:13): [True: 154, False: 0]
  |  Branch (1250:26): [True: 30, False: 124]
  ------------------
 1251|       |
 1252|     30|            if (modid == -1)    /* Any module */
  ------------------
  |  Branch (1252:17): [True: 30, False: 0]
  ------------------
 1253|     30|                return (tp);
 1254|       |
 1255|      0|            for (int_p = tp->module_list, count = 0;
 1256|      0|                 count < tp->number_modules; ++count, ++int_p)
  ------------------
  |  Branch (1256:18): [True: 0, False: 0]
  ------------------
 1257|      0|                if (*int_p == modid)
  ------------------
  |  Branch (1257:21): [True: 0, False: 0]
  ------------------
 1258|      0|                    return (tp);
 1259|      0|        }
 1260|    154|    }
 1261|       |
 1262|    334|    return (NULL);
 1263|    364|}
find_best_tree_node:
 1341|    337|{
 1342|    337|    struct tree    *tp, *best_so_far = NULL, *retptr;
 1343|    337|    u_int           old_match = MAX_BAD, new_match = MAX_BAD;
  ------------------
  |  | 1270|    337|#define MAX_BAD 0xffffff
  ------------------
                  u_int           old_match = MAX_BAD, new_match = MAX_BAD;
  ------------------
  |  | 1270|    337|#define MAX_BAD 0xffffff
  ------------------
 1344|       |
 1345|    337|    if (!pattrn || !*pattrn)
  ------------------
  |  Branch (1345:9): [True: 0, False: 337]
  |  Branch (1345:20): [True: 1, False: 336]
  ------------------
 1346|      1|        return (NULL);
 1347|       |
 1348|    336|    if (!tree_top)
  ------------------
  |  Branch (1348:9): [True: 29, False: 307]
  ------------------
 1349|     29|        tree_top = get_tree_head();
 1350|       |
 1351|  1.24k|    for (tp = tree_top; tp; tp = tp->next_peer) {
  ------------------
  |  Branch (1351:25): [True: 915, False: 327]
  ------------------
 1352|    915|        if (!tp->reported && tp->label)
  ------------------
  |  Branch (1352:13): [True: 915, False: 0]
  |  Branch (1352:30): [True: 915, False: 0]
  ------------------
 1353|    915|            new_match = compute_match(tp->label, pattrn);
 1354|    915|        tp->reported = 1;
 1355|       |
 1356|    915|        if (new_match < old_match) {
  ------------------
  |  Branch (1356:13): [True: 34, False: 881]
  ------------------
 1357|     34|            best_so_far = tp;
 1358|     34|            old_match = new_match;
 1359|     34|        }
 1360|    915|        if (new_match == 0)
  ------------------
  |  Branch (1360:13): [True: 9, False: 906]
  ------------------
 1361|      9|            break;              /* this is the best result we can get */
 1362|    906|        if (tp->child_list) {
  ------------------
  |  Branch (1362:13): [True: 0, False: 906]
  ------------------
 1363|      0|            retptr =
 1364|      0|                find_best_tree_node(pattrn, tp->child_list, &new_match);
 1365|      0|            if (new_match < old_match) {
  ------------------
  |  Branch (1365:17): [True: 0, False: 0]
  ------------------
 1366|      0|                best_so_far = retptr;
 1367|      0|                old_match = new_match;
 1368|      0|            }
 1369|      0|            if (new_match == 0)
  ------------------
  |  Branch (1369:17): [True: 0, False: 0]
  ------------------
 1370|      0|                break;          /* this is the best result we can get */
 1371|      0|        }
 1372|    906|    }
 1373|    336|    if (match)
  ------------------
  |  Branch (1373:9): [True: 0, False: 336]
  ------------------
 1374|      0|        *match = old_match;
 1375|    336|    return (best_so_far);
 1376|    337|}
which_module:
 3805|    189|{
 3806|    189|    struct module  *mp;
 3807|       |
 3808|    189|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3808:28): [True: 0, False: 189]
  ------------------
 3809|      0|        if (!label_compare(mp->name, name))
  ------------------
  |  | 1235|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3809:13): [True: 0, False: 0]
  ------------------
 3810|      0|            return (mp->modid);
 3811|       |
 3812|    189|    DEBUGMSGTL(("parse-mibs", "Module %s not found\n", name));
  ------------------
  |  |   66|    189|#define DEBUGMSGTL(x)      do {if (_DBG_IF_) {__DBGMSGTL(x);} }while(0)
  |  |  ------------------
  |  |  |  |  144|    189|#define _DBG_IF_            snmp_get_do_debugging()
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (144:29): [True: 0, False: 189]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #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 - Ignored]
  |  |  ------------------
  ------------------
 3813|    189|    return (-1);
 3814|    189|}
netsnmp_read_module:
 4077|    199|{
 4078|    199|    int status = 0;
 4079|    199|    status = read_module_internal(name);
 4080|       |
 4081|    199|    if (status == MODULE_NOT_FOUND) {
  ------------------
  |  |  513|    199|#define MODULE_NOT_FOUND	0
  ------------------
  |  Branch (4081:9): [True: 199, False: 0]
  ------------------
 4082|    199|        if (!read_module_replacements(name))
  ------------------
  |  Branch (4082:13): [True: 186, False: 13]
  ------------------
 4083|    186|            print_module_not_found(name);
 4084|    199|    } else if (status == MODULE_SYNTAX_ERROR) {
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (4084:16): [True: 0, False: 0]
  ------------------
 4085|      0|        gMibError = 0;
 4086|      0|        gLoop = 1;
 4087|       |
 4088|      0|        strncat(gMibNames, " ", sizeof(gMibNames) - strlen(gMibNames) - 1);
 4089|      0|        strncat(gMibNames, name, sizeof(gMibNames) - strlen(gMibNames) - 1);
 4090|      0|    }
 4091|       |
 4092|    199|    return tree_head;
 4093|    199|}
parse.c:name_hash:
  687|    459|{
  688|    459|    int             hash = 0;
  689|    459|    const char     *cp;
  690|       |
  691|    459|    if (!name)
  ------------------
  |  Branch (691:9): [True: 0, False: 459]
  ------------------
  692|      0|        return 0;
  693|  6.53k|    for (cp = name; *cp; cp++)
  ------------------
  |  Branch (693:21): [True: 6.07k, False: 459]
  ------------------
  694|  6.07k|        hash += tolower((unsigned char)(*cp));
  695|    459|    return (hash);
  696|    459|}
parse.c:build_translation_table:
 1070|      1|{
 1071|      1|    int             count;
 1072|       |
 1073|    257|    for (count = 0; count < 256; count++) {
  ------------------
  |  Branch (1073:21): [True: 256, False: 1]
  ------------------
 1074|    256|        switch (count) {
 1075|      1|        case OBJID:
  ------------------
  |  |  167|      1|#define OBJID       (4 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1075:9): [True: 1, False: 255]
  ------------------
 1076|      1|            translation_table[count] = TYPE_OBJID;
  ------------------
  |  |  155|      1|#define TYPE_OBJID          1
  ------------------
 1077|      1|            break;
 1078|      1|        case OCTETSTR:
  ------------------
  |  |  168|      1|#define OCTETSTR    (5 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1078:9): [True: 1, False: 255]
  ------------------
 1079|      1|            translation_table[count] = TYPE_OCTETSTR;
  ------------------
  |  |  156|      1|#define TYPE_OCTETSTR       2
  ------------------
 1080|      1|            break;
 1081|      1|        case INTEGER:
  ------------------
  |  |  169|      1|#define INTEGER     (6 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1081:9): [True: 1, False: 255]
  ------------------
 1082|      1|            translation_table[count] = TYPE_INTEGER;
  ------------------
  |  |  157|      1|#define TYPE_INTEGER        3
  ------------------
 1083|      1|            break;
 1084|      1|        case NETADDR:
  ------------------
  |  |  170|      1|#define NETADDR     (7 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1084:9): [True: 1, False: 255]
  ------------------
 1085|      1|            translation_table[count] = TYPE_NETADDR;
  ------------------
  |  |  158|      1|#define TYPE_NETADDR        4
  ------------------
 1086|      1|            break;
 1087|      1|        case IPADDR:
  ------------------
  |  |  171|      1|#define IPADDR      (8 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1087:9): [True: 1, False: 255]
  ------------------
 1088|      1|            translation_table[count] = TYPE_IPADDR;
  ------------------
  |  |  159|      1|#define TYPE_IPADDR         5
  ------------------
 1089|      1|            break;
 1090|      1|        case COUNTER:
  ------------------
  |  |  172|      1|#define COUNTER     (9 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1090:9): [True: 1, False: 255]
  ------------------
 1091|      1|            translation_table[count] = TYPE_COUNTER;
  ------------------
  |  |  160|      1|#define TYPE_COUNTER        6
  ------------------
 1092|      1|            break;
 1093|      1|        case GAUGE:
  ------------------
  |  |  173|      1|#define GAUGE       (10 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1093:9): [True: 1, False: 255]
  ------------------
 1094|      1|            translation_table[count] = TYPE_GAUGE;
  ------------------
  |  |  161|      1|#define TYPE_GAUGE          7
  ------------------
 1095|      1|            break;
 1096|      1|        case TIMETICKS:
  ------------------
  |  |  174|      1|#define TIMETICKS   (11 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1096:9): [True: 1, False: 255]
  ------------------
 1097|      1|            translation_table[count] = TYPE_TIMETICKS;
  ------------------
  |  |  162|      1|#define TYPE_TIMETICKS      8
  ------------------
 1098|      1|            break;
 1099|      1|        case KW_OPAQUE:
  ------------------
  |  |  175|      1|#define KW_OPAQUE   (12 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1099:9): [True: 1, False: 255]
  ------------------
 1100|      1|            translation_table[count] = TYPE_OPAQUE;
  ------------------
  |  |  163|      1|#define TYPE_OPAQUE         9
  ------------------
 1101|      1|            break;
 1102|      1|        case NUL:
  ------------------
  |  |  176|      1|#define NUL         (13 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1102:9): [True: 1, False: 255]
  ------------------
 1103|      1|            translation_table[count] = TYPE_NULL;
  ------------------
  |  |  164|      1|#define TYPE_NULL           10
  ------------------
 1104|      1|            break;
 1105|      1|        case COUNTER64:
  ------------------
  |  |  211|      1|#define COUNTER64   (43 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1105:9): [True: 1, False: 255]
  ------------------
 1106|      1|            translation_table[count] = TYPE_COUNTER64;
  ------------------
  |  |  165|      1|#define TYPE_COUNTER64      11
  ------------------
 1107|      1|            break;
 1108|      1|        case BITSTRING:
  ------------------
  |  |  209|      1|#define BITSTRING   (41 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1108:9): [True: 1, False: 255]
  ------------------
 1109|      1|            translation_table[count] = TYPE_BITSTRING;
  ------------------
  |  |  166|      1|#define TYPE_BITSTRING      12
  ------------------
 1110|      1|            break;
 1111|      1|        case NSAPADDRESS:
  ------------------
  |  |  210|      1|#define NSAPADDRESS (42 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1111:9): [True: 1, False: 255]
  ------------------
 1112|      1|            translation_table[count] = TYPE_NSAPADDRESS;
  ------------------
  |  |  167|      1|#define TYPE_NSAPADDRESS    13
  ------------------
 1113|      1|            break;
 1114|      1|        case INTEGER32:
  ------------------
  |  |  274|      1|#define INTEGER32	(105 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1114:9): [True: 1, False: 255]
  ------------------
 1115|      1|            translation_table[count] = TYPE_INTEGER32;
  ------------------
  |  |  170|      1|#define TYPE_INTEGER32      16
  ------------------
 1116|      1|            break;
 1117|      1|        case UINTEGER32:
  ------------------
  |  |  224|      1|#define UINTEGER32 (56 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1117:9): [True: 1, False: 255]
  ------------------
 1118|      1|            translation_table[count] = TYPE_UINTEGER;
  ------------------
  |  |  168|      1|#define TYPE_UINTEGER       14
  ------------------
 1119|      1|            break;
 1120|      1|        case UNSIGNED32:
  ------------------
  |  |  273|      1|#define UNSIGNED32	(104 | SYNTAX_MASK)
  |  |  ------------------
  |  |  |  |  157|      1|#define SYNTAX_MASK     0x80
  |  |  ------------------
  ------------------
  |  Branch (1120:9): [True: 1, False: 255]
  ------------------
 1121|      1|            translation_table[count] = TYPE_UNSIGNED32;
  ------------------
  |  |  169|      1|#define TYPE_UNSIGNED32     15
  ------------------
 1122|      1|            break;
 1123|      1|        case TRAPTYPE:
  ------------------
  |  |  229|      1|#define TRAPTYPE    61
  ------------------
  |  Branch (1123:9): [True: 1, False: 255]
  ------------------
 1124|      1|            translation_table[count] = TYPE_TRAPTYPE;
  ------------------
  |  |  174|      1|#define TYPE_TRAPTYPE	    20
  ------------------
 1125|      1|            break;
 1126|      1|        case NOTIFTYPE:
  ------------------
  |  |  213|      1|#define NOTIFTYPE   45
  ------------------
  |  Branch (1126:9): [True: 1, False: 255]
  ------------------
 1127|      1|            translation_table[count] = TYPE_NOTIFTYPE;
  ------------------
  |  |  175|      1|#define TYPE_NOTIFTYPE      21
  ------------------
 1128|      1|            break;
 1129|      1|        case NOTIFGROUP:
  ------------------
  |  |  258|      1|#define NOTIFGROUP  88
  ------------------
  |  Branch (1129:9): [True: 1, False: 255]
  ------------------
 1130|      1|            translation_table[count] = TYPE_NOTIFGROUP;
  ------------------
  |  |  177|      1|#define TYPE_NOTIFGROUP	    23
  ------------------
 1131|      1|            break;
 1132|      1|        case OBJGROUP:
  ------------------
  |  |  212|      1|#define OBJGROUP    44
  ------------------
  |  Branch (1132:9): [True: 1, False: 255]
  ------------------
 1133|      1|            translation_table[count] = TYPE_OBJGROUP;
  ------------------
  |  |  176|      1|#define TYPE_OBJGROUP	    22
  ------------------
 1134|      1|            break;
 1135|      1|        case MODULEIDENTITY:
  ------------------
  |  |  220|      1|#define MODULEIDENTITY 52
  ------------------
  |  Branch (1135:9): [True: 1, False: 255]
  ------------------
 1136|      1|            translation_table[count] = TYPE_MODID;
  ------------------
  |  |  178|      1|#define TYPE_MODID	    24
  ------------------
 1137|      1|            break;
 1138|      1|        case OBJIDENTITY:
  ------------------
  |  |  275|      1|#define OBJIDENTITY	106
  ------------------
  |  Branch (1138:9): [True: 1, False: 255]
  ------------------
 1139|      1|            translation_table[count] = TYPE_OBJIDENTITY;
  ------------------
  |  |  181|      1|#define TYPE_OBJIDENTITY    27
  ------------------
 1140|      1|            break;
 1141|      1|        case AGENTCAP:
  ------------------
  |  |  243|      1|#define AGENTCAP    73
  ------------------
  |  Branch (1141:9): [True: 1, False: 255]
  ------------------
 1142|      1|            translation_table[count] = TYPE_AGENTCAP;
  ------------------
  |  |  179|      1|#define TYPE_AGENTCAP       25
  ------------------
 1143|      1|            break;
 1144|      1|        case COMPLIANCE:
  ------------------
  |  |  215|      1|#define COMPLIANCE  47
  ------------------
  |  Branch (1144:9): [True: 1, False: 255]
  ------------------
 1145|      1|            translation_table[count] = TYPE_MODCOMP;
  ------------------
  |  |  180|      1|#define TYPE_MODCOMP        26
  ------------------
 1146|      1|            break;
 1147|    232|        default:
  ------------------
  |  Branch (1147:9): [True: 232, False: 24]
  ------------------
 1148|    232|            translation_table[count] = TYPE_OTHER;
  ------------------
  |  |  154|    232|#define TYPE_OTHER          0
  ------------------
 1149|    232|            break;
 1150|    256|        }
 1151|    256|    }
 1152|      1|}
parse.c:init_tree_roots:
 1156|      1|{
 1157|      1|    struct tree    *tp, *lasttp;
 1158|      1|    int             base_modid;
 1159|      1|    int             hash;
 1160|       |
 1161|      1|    base_modid = which_module("SNMPv2-SMI");
 1162|      1|    if (base_modid == -1)
  ------------------
  |  Branch (1162:9): [True: 1, False: 0]
  ------------------
 1163|      1|        base_modid = which_module("RFC1155-SMI");
 1164|      1|    if (base_modid == -1)
  ------------------
  |  Branch (1164:9): [True: 1, False: 0]
  ------------------
 1165|      1|        base_modid = which_module("RFC1213-MIB");
 1166|       |
 1167|       |    /*
 1168|       |     * build root node 
 1169|       |     */
 1170|      1|    tp = calloc(1, sizeof(struct tree));
 1171|      1|    if (tp == NULL)
  ------------------
  |  Branch (1171:9): [True: 0, False: 1]
  ------------------
 1172|      0|        return;
 1173|      1|    tp->label = strdup("joint-iso-ccitt");
 1174|      1|    tp->modid = base_modid;
 1175|      1|    tp->number_modules = 1;
 1176|      1|    tp->module_list = &(tp->modid);
 1177|      1|    tp->subid = 2;
 1178|      1|    tp->tc_index = -1;
 1179|      1|    set_function(tp);           /* from mib.c */
 1180|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1181|      1|    tp->next = tbuckets[hash];
 1182|      1|    tbuckets[hash] = tp;
 1183|      1|    lasttp = tp;
 1184|      1|    root_imports[0].label = strdup(tp->label);
 1185|      1|    root_imports[0].modid = base_modid;
 1186|       |
 1187|       |    /*
 1188|       |     * build root node 
 1189|       |     */
 1190|      1|    tp = calloc(1, sizeof(struct tree));
 1191|      1|    if (tp == NULL)
  ------------------
  |  Branch (1191:9): [True: 0, False: 1]
  ------------------
 1192|      0|        return;
 1193|      1|    tp->next_peer = lasttp;
 1194|      1|    tp->label = strdup("ccitt");
 1195|      1|    tp->modid = base_modid;
 1196|      1|    tp->number_modules = 1;
 1197|      1|    tp->module_list = &(tp->modid);
 1198|      1|    tp->subid = 0;
 1199|      1|    tp->tc_index = -1;
 1200|      1|    set_function(tp);           /* from mib.c */
 1201|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1202|      1|    tp->next = tbuckets[hash];
 1203|      1|    tbuckets[hash] = tp;
 1204|      1|    lasttp = tp;
 1205|      1|    root_imports[1].label = strdup(tp->label);
 1206|      1|    root_imports[1].modid = base_modid;
 1207|       |
 1208|       |    /*
 1209|       |     * build root node 
 1210|       |     */
 1211|      1|    tp = calloc(1, sizeof(struct tree));
 1212|      1|    if (tp == NULL)
  ------------------
  |  Branch (1212:9): [True: 0, False: 1]
  ------------------
 1213|      0|        return;
 1214|      1|    tp->next_peer = lasttp;
 1215|      1|    tp->label = strdup("iso");
 1216|      1|    tp->modid = base_modid;
 1217|      1|    tp->number_modules = 1;
 1218|      1|    tp->module_list = &(tp->modid);
 1219|      1|    tp->subid = 1;
 1220|      1|    tp->tc_index = -1;
 1221|      1|    set_function(tp);           /* from mib.c */
 1222|      1|    hash = NBUCKET(name_hash(tp->label));
  ------------------
  |  |  530|      1|#define NBUCKET(x)   (x & (NHASHSIZE-1))
  |  |  ------------------
  |  |  |  |  529|      1|#define NHASHSIZE    128
  |  |  ------------------
  ------------------
 1223|      1|    tp->next = tbuckets[hash];
 1224|      1|    tbuckets[hash] = tp;
 1225|      1|    lasttp = tp;
 1226|      1|    root_imports[2].label = strdup(tp->label);
 1227|      1|    root_imports[2].modid = base_modid;
 1228|       |
 1229|      1|    tree_head = tp;
 1230|      1|}
parse.c:compute_match:
 1274|    915|{
 1275|    915|#if defined(HAVE_REGEX_H) && defined(HAVE_REGCOMP)
 1276|    915|    int             rc;
 1277|    915|    regex_t         parsetree;
 1278|    915|    regmatch_t      pmatch;
 1279|    915|    rc = regcomp(&parsetree, key, REG_ICASE | REG_EXTENDED);
 1280|    915|    if (rc == 0)
  ------------------
  |  Branch (1280:9): [True: 864, False: 51]
  ------------------
 1281|    864|        rc = regexec(&parsetree, search_base, 1, &pmatch, 0);
 1282|    915|    regfree(&parsetree);
 1283|    915|    if (rc == 0) {
  ------------------
  |  Branch (1283:9): [True: 38, False: 877]
  ------------------
 1284|       |        /*
 1285|       |         * found 
 1286|       |         */
 1287|     38|        return pmatch.rm_so;
 1288|     38|    }
 1289|       |#else                           /* use our own wildcard matcher */
 1290|       |    /*
 1291|       |     * first find the longest matching substring (ick) 
 1292|       |     */
 1293|       |    char           *first = NULL, *result = NULL, *entry;
 1294|       |    const char     *position;
 1295|       |    char           *newkey = strdup(key);
 1296|       |    char           *st;
 1297|       |
 1298|       |
 1299|       |    entry = strtok_r(newkey, "*", &st);
 1300|       |    position = search_base;
 1301|       |    while (entry) {
 1302|       |        result = strcasestr(position, entry);
 1303|       |
 1304|       |        if (result == NULL) {
 1305|       |            free(newkey);
 1306|       |            return MAX_BAD;
 1307|       |        }
 1308|       |
 1309|       |        if (first == NULL)
 1310|       |            first = result;
 1311|       |
 1312|       |        position = result + strlen(entry);
 1313|       |        entry = strtok_r(NULL, "*", &st);
 1314|       |    }
 1315|       |    free(newkey);
 1316|       |    if (result)
 1317|       |        return (first - search_base);
 1318|       |#endif
 1319|       |
 1320|       |    /*
 1321|       |     * not found 
 1322|       |     */
 1323|    877|    return MAX_BAD;
  ------------------
  |  | 1270|    877|#define MAX_BAD 0xffffff
  ------------------
 1324|    915|}
parse.c:read_module_internal:
 3938|    199|{
 3939|    199|    struct module  *mp;
 3940|    199|    FILE           *fp;
 3941|    199|    struct node    *np;
 3942|    199|    int             res;
 3943|       |
 3944|    199|    netsnmp_init_mib_internals();
 3945|       |
 3946|    199|    for (mp = module_head; mp; mp = mp->next)
  ------------------
  |  Branch (3946:28): [True: 0, False: 199]
  ------------------
 3947|      0|        if (!label_compare(mp->name, name)) {
  ------------------
  |  | 1235|      0|#define	label_compare	strcmp
  ------------------
  |  Branch (3947:13): [True: 0, False: 0]
  ------------------
 3948|      0|            const char     *oldFile = File;
 3949|      0|            int             oldLine = mibLine;
 3950|      0|            int             oldModule = current_module;
 3951|       |
 3952|      0|            if (mp->no_imports != -1) {
  ------------------
  |  Branch (3952:17): [True: 0, False: 0]
  ------------------
 3953|      0|                DEBUGMSGTL(("parse-mibs", "Module %s already loaded\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 - Ignored]
  |  |  ------------------
  ------------------
 3954|      0|                            name));
 3955|      0|                return MODULE_ALREADY_LOADED;
  ------------------
  |  |  515|      0|#define MODULE_ALREADY_LOADED	2
  ------------------
 3956|      0|            }
 3957|      0|            if ((fp = fopen(mp->file, "r")) == NULL) {
  ------------------
  |  Branch (3957:17): [True: 0, False: 0]
  ------------------
 3958|      0|                int rval;
 3959|      0|                if (errno == ENOTDIR || errno == ENOENT)
  ------------------
  |  Branch (3959:21): [True: 0, False: 0]
  |  Branch (3959:41): [True: 0, False: 0]
  ------------------
 3960|      0|                    rval = MODULE_NOT_FOUND;
  ------------------
  |  |  513|      0|#define MODULE_NOT_FOUND	0
  ------------------
 3961|      0|                else
 3962|      0|                    rval = MODULE_LOAD_FAILED;
  ------------------
  |  |  519|      0|#define MODULE_LOAD_FAILED	MODULE_NOT_FOUND
  |  |  ------------------
  |  |  |  |  513|      0|#define MODULE_NOT_FOUND	0
  |  |  ------------------
  ------------------
 3963|      0|                snmp_log_perror(mp->file);
 3964|      0|                return rval;
 3965|      0|            }
 3966|      0|#ifdef HAVE_FLOCKFILE
 3967|      0|            flockfile(fp);
 3968|      0|#endif
 3969|      0|            mp->no_imports = 0; /* Note that we've read the file */
 3970|      0|            File = mp->file;
 3971|      0|            mibLine = 1;
 3972|      0|            current_module = mp->modid;
 3973|       |            /*
 3974|       |             * Parse the file
 3975|       |             */
 3976|      0|            np = parse(fp);
 3977|      0|#ifdef HAVE_FUNLOCKFILE
 3978|      0|            funlockfile(fp);
 3979|      0|#endif
 3980|      0|            fclose(fp);
 3981|      0|            File = oldFile;
 3982|      0|            mibLine = oldLine;
 3983|      0|            current_module = oldModule;
 3984|      0|            res = !np && gMibError == MODULE_SYNTAX_ERROR ?
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
  |  Branch (3984:19): [True: 0, False: 0]
  |  Branch (3984:26): [True: 0, False: 0]
  ------------------
 3985|      0|                MODULE_SYNTAX_ERROR : MODULE_LOADED_OK;
  ------------------
  |  |  520|      0|#define MODULE_SYNTAX_ERROR     4
  ------------------
                              MODULE_SYNTAX_ERROR : MODULE_LOADED_OK;
  ------------------
  |  |  514|      0|#define MODULE_LOADED_OK	1
  ------------------
 3986|      0|            while (np) {
  ------------------
  |  Branch (3986:20): [True: 0, False: 0]
  ------------------
 3987|      0|                struct node *nnp = np->next;
 3988|      0|                free_node(np);
 3989|      0|                np = nnp;
 3990|      0|            }
 3991|      0|            return res;
 3992|      0|        }
 3993|       |
 3994|    199|    return MODULE_NOT_FOUND;
  ------------------
  |  |  513|    199|#define MODULE_NOT_FOUND	0
  ------------------
 3995|    199|}
parse.c:print_error:
  779|    177|{
  780|    177|    erroneousMibs++;
  781|    177|    if (!netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
  ------------------
  |  |   48|    177|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (781:9): [True: 177, False: 0]
  ------------------
  782|    177|                                NETSNMP_DS_LIB_MIB_ERRORS))
  ------------------
  |  |   59|    177|#define NETSNMP_DS_LIB_MIB_ERRORS          0
  ------------------
  783|    177|	return;
  784|      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 - Ignored]
  |  |  ------------------
  ------------------
  785|      0|    if (type == ENDOFFILE)
  ------------------
  |  |  163|      0|#define ENDOFFILE   0
  ------------------
  |  Branch (785:9): [True: 0, False: 0]
  ------------------
  786|      0|        snmp_log(LOG_ERR, "%s (EOF): At line %d in %s\n", str, mibLine,
  787|      0|                 File);
  788|      0|    else if (token && *token)
  ------------------
  |  Branch (788:14): [True: 0, False: 0]
  |  Branch (788:23): [True: 0, False: 0]
  ------------------
  789|      0|        snmp_log(LOG_ERR, "%s (%s): At line %d in %s\n", str, token,
  790|      0|                 mibLine, File);
  791|      0|    else
  792|      0|        snmp_log(LOG_ERR, "%s: At line %d in %s\n", str, mibLine, File);
  793|      0|}
parse.c:read_module_replacements:
 3869|    199|{
 3870|    199|    struct module_compatability *mcp;
 3871|       |
 3872|  4.37k|    for (mcp = module_map_head; mcp; mcp = mcp->next) {
  ------------------
  |  Branch (3872:33): [True: 4.19k, False: 186]
  ------------------
 3873|  4.19k|        if (!label_compare(mcp->old_module, name)) {
  ------------------
  |  | 1235|  4.19k|#define	label_compare	strcmp
  ------------------
  |  Branch (3873:13): [True: 13, False: 4.17k]
  ------------------
 3874|     13|            if (netsnmp_ds_get_int(NETSNMP_DS_LIBRARY_ID, 
  ------------------
  |  |   48|     13|#define NETSNMP_DS_LIBRARY_ID     0
  ------------------
  |  Branch (3874:17): [True: 0, False: 13]
  ------------------
 3875|     13|				   NETSNMP_DS_LIB_MIB_WARNINGS)) {
  ------------------
  |  |  114|     13|#define NETSNMP_DS_LIB_MIB_WARNINGS         0
  ------------------
 3876|      0|                snmp_log(LOG_WARNING,
 3877|      0|                         "Loading replacement module %s for %s (%s)\n",
 3878|      0|                         mcp->new_module, name, File);
 3879|      0|	    }
 3880|     13|            (void) netsnmp_read_module(mcp->new_module);
 3881|     13|            return 1;
 3882|     13|        }
 3883|  4.19k|    }
 3884|    186|    return 0;
 3885|    199|}
parse.c:print_module_not_found:
  797|    186|{
  798|    186|    if (first_err_module) {
  ------------------
  |  Branch (798:9): [True: 1, False: 185]
  ------------------
  799|      1|        snmp_log(LOG_ERR, "MIB search path: %s\n",
  800|      1|                           netsnmp_get_mib_directory());
  801|      1|        first_err_module = 0;
  802|      1|    }
  803|    186|    if (!last_err_module || strcmp(cp, last_err_module))
  ------------------
  |  Branch (803:9): [True: 1, False: 185]
  |  Branch (803:29): [True: 176, False: 9]
  ------------------
  804|    177|        print_error("Cannot find module", cp, CONTINUE);
  ------------------
  |  |  162|    177|#define CONTINUE    -1
  ------------------
  805|    186|    if (last_err_module)
  ------------------
  |  Branch (805:9): [True: 185, False: 1]
  ------------------
  806|    185|        free(last_err_module);
  807|    186|    last_err_module = strdup(cp);
  808|    186|}

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

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

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

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

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

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

