features: don't break linked list, create separate one for arc
[vpp.git] / src / vlib / init.h
index 1eddbb1..f163ee2 100644 (file)
@@ -81,20 +81,22 @@ typedef struct vlib_config_function_runtime_t
 
 #define VLIB_REMOVE_FROM_LINKED_LIST(first,p,next)              \
 {                                                               \
+  ASSERT (first);                                               \
   if (first == p)                                               \
       first = (p)->next;                                        \
   else                                                          \
     {                                                           \
       __typeof__ (p) current = first;                           \
-       while (current->next)                                   \
-         {                                                     \
-           if (current->next == p)                             \
-             {                                                 \
-               current->next = current->next->next;            \
-               break;                                          \
-             }                                                 \
-           current = current->next;                            \
-         }                                                     \
+      while (current->next)                                     \
+       {                                                       \
+         if (current->next == p)                               \
+           {                                                   \
+             current->next = current->next->next;              \
+             break;                                            \
+           }                                                   \
+         current = current->next;                              \
+       }                                                       \
+      ASSERT (current);                                         \
     }                                                           \
 }