This file is indexed.

/usr/include/net-snmp/library/snmp_assert.h is in libsnmp-dev 5.7.2~dfsg-8.1ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#ifndef SNMP_ASSERT_H
#define SNMP_ASSERT_H

#ifdef NETSNMP_USE_ASSERT
#   include <assert.h>
#else
#   include <net-snmp/library/snmp_logging.h>
#endif


/*
 * MACROs don't need extern "C"
 */

/*
 * define __STRING for systems (*cough* sun *cough*) that don't have it
 */
#ifndef __STRING
#  if defined(__STDC__) || defined(_MSC_VER)
#    define __STRING(x) #x
#  else
#    define __STRING(x) "x"
#  endif /* __STDC__ */
#endif /* __STRING */

/*
 * always use assert if requested
 */
#ifdef NETSNMP_USE_ASSERT
/*   void netsnmp_assert( int );*/
#   define netsnmp_assert(x)  assert( x )
#   define netsnmp_assert_or_return(x, y)  assert( x )
#   define netsnmp_assert_or_msgreturn(x, y, z)  assert( x )
#else
/*
 *  if asserts weren't requested, just log, unless NETSNMP_NO_DEBUGGING specified
 */
#   ifndef NETSNMP_NO_DEBUGGING
#      ifdef  NETSNMP_FUNCTION
#          define NETSNMP_FUNC_FMT " %s()\n"
#          define NETSNMP_FUNC_PARAM NETSNMP_FUNCTION
#      else
#          define NETSNMP_FUNC_FMT "%c"
#          define NETSNMP_FUNC_PARAM '\n'
#      endif
#
#      define netsnmp_assert(x)  do { \
              if ( x ) \
                 ; \
              else \
                 snmp_log(LOG_ERR, \
                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
                          __STRING(x),__FILE__,__LINE__, \
                          NETSNMP_FUNC_PARAM); \
           }while(0)
#      define netsnmp_assert_or_return(x, y)  do {        \
              if ( x ) \
                 ; \
              else { \
                 snmp_log(LOG_ERR, \
                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
                          __STRING(x),__FILE__,__LINE__, \
                          NETSNMP_FUNC_PARAM); \
                 return y; \
              } \
           }while(0)
#      define netsnmp_assert_or_msgreturn(x, y, z)  do {       \
              if ( x ) \
                 ; \
              else { \
                 snmp_log(LOG_ERR, \
                          "netsnmp_assert %s failed %s:%d" NETSNMP_FUNC_FMT, \
                          __STRING(x),__FILE__,__LINE__, \
                          NETSNMP_FUNC_PARAM); \
                 snmp_log(LOG_ERR, y); \
                 return z; \
              } \
           }while(0)
#   else /* NO DEBUGGING */
#      define netsnmp_assert(x)
#      define netsnmp_assert_or_return(x, y)  do {        \
                 if ( x ) \
                    ; \
                 else { \
                    return y; \
                 } \
              }while(0)
#      define netsnmp_assert_or_msgreturn(x, y, z)  do {       \
                 if ( x ) \
                    ; \
                 else { \
                    return z; \
                 } \
              }while(0)
#   endif /* NO DEBUGGING */
#endif /* not NETSNMP_USE_ASSERT */


#define netsnmp_static_assert(x) \
    do { switch(0) { case (x): case 0: ; } } while(0)


/*
 *  EXPERIMENTAL macros. May be removed without warning in future
 * releases. Use at your own risk
 *
 * The series of uppercase letters at or near the end of these macros give
 * an indication of what they do. The letters used are:
 *
 *   L  : log a message
 *   RN : return NULL
 *   RE : return a specific hardcoded error appropriate for the condition
 *   RV : return user specified value
 *
 */
#define netsnmp_malloc_check_LRN(ptr)           \
    netsnmp_assert_or_return( (ptr) != NULL, NULL)
#define netsnmp_malloc_check_LRE(ptr)           \
    netsnmp_assert_or_return( (ptr) != NULL, SNMPERR_MALLOC)
#define netsnmp_malloc_check_LRV(ptr, val)                          \
    netsnmp_assert_or_return( (ptr) != NULL, val)

#define netsnmp_require_ptr_LRV( ptr, val ) \
    netsnmp_assert_or_return( (ptr) != NULL, val)


#endif /* SNMP_ASSERT_H */