Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git] / lib / sset.h
index 327074c..1e864ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -70,22 +70,26 @@ struct sset_node *sset_at_position(const struct sset *,
 /* Iteration macros. */
 #define SSET_FOR_EACH(NAME, SSET)               \
     for ((NAME) = SSET_FIRST(SSET);             \
-         SSET_NODE_FROM_NAME(NAME) != NULL;     \
+         NAME != NULL;                          \
          (NAME) = SSET_NEXT(SSET, NAME))
 
 #define SSET_FOR_EACH_SAFE(NAME, NEXT, SSET)        \
     for ((NAME) = SSET_FIRST(SSET);                 \
-         (SSET_NODE_FROM_NAME(NAME) != NULL         \
+         (NAME != NULL                              \
           ? (NEXT) = SSET_NEXT(SSET, NAME), true    \
           : false);                                 \
          (NAME) = (NEXT))
+
+const char **sset_sort(const struct sset *);
 \f
 /* Implementation helper macros. */
 
 #define SSET_NODE_FROM_HMAP_NODE(HMAP_NODE) \
     CONTAINER_OF(HMAP_NODE, struct sset_node, hmap_node)
 #define SSET_NAME_FROM_HMAP_NODE(HMAP_NODE) \
-    (CONST_CAST(const char *, (SSET_NODE_FROM_HMAP_NODE(HMAP_NODE)->name)))
+    HMAP_NODE == NULL                       \
+    ? NULL                                  \
+    : (CONST_CAST(const char *, (SSET_NODE_FROM_HMAP_NODE(HMAP_NODE)->name)))
 #define SSET_NODE_FROM_NAME(NAME) CONTAINER_OF(NAME, struct sset_node, name)
 #define SSET_FIRST(SSET) SSET_NAME_FROM_HMAP_NODE(hmap_first(&(SSET)->map))
 #define SSET_NEXT(SSET, NAME)                                           \