Print this page
Reduce lint

Split Close
Expand all
Collapse all
          --- old/usr/src/common/list/list.c
          +++ new/usr/src/common/list/list.c
↓ open down ↓ 30 lines elided ↑ open up ↑
  31   31  #include <sys/types.h>
  32   32  #include <sys/sysmacros.h>
  33   33  #ifdef _KERNEL
  34   34  #include <sys/debug.h>
  35   35  #else
  36   36  #include <assert.h>
  37   37  #define ASSERT(a)       assert(a)
  38   38  #endif
  39   39  
  40   40  #ifdef lint
  41      -extern list_node_t *list_d2l(list_t *list, void *obj);
       41 +static list_node_t *
       42 +list_d2l(list_t *list, void *obj)
       43 +{
       44 +        /* Pretty version for lint... */
       45 +        uint64_t *offset = (uint64_t *)obj;
       46 +
       47 +        if (!IS_P2ALIGNED(obj, 8))
       48 +                return (NULL);
       49 +
       50 +        return ((list_node_t *)(offset + (list->list_offset >> 3)));
       51 +}
  42   52  #else
  43   53  #define list_d2l(a, obj) ((list_node_t *)(((char *)obj) + (a)->list_offset))
  44   54  #endif
  45   55  #define list_object(a, node) ((void *)(((char *)node) - (a)->list_offset))
  46   56  #define list_empty(a) ((a)->list_head.list_next == &(a)->list_head)
  47   57  
  48   58  #define list_insert_after_node(list, node, object) {    \
  49   59          list_node_t *lnew = list_d2l(list, object);     \
  50   60          lnew->list_prev = (node);                       \
  51   61          lnew->list_next = (node)->list_next;            \
↓ open down ↓ 200 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX