system-stats: Use "smap" instead of "shash".
[openvswitch] / lib / ovsdb-data.c
index 58c2a10a076fc98936ea398c6b28b3ed42d07089..3e6f20bbee239b85291e0680891d9d608d4fb8de 100644 (file)
@@ -29,6 +29,7 @@
 #include "ovsdb-parser.h"
 #include "json.h"
 #include "shash.h"
+#include "smap.h"
 #include "sort.h"
 #include "unicode.h"
 
@@ -1524,27 +1525,26 @@ ovsdb_datum_to_bare(const struct ovsdb_datum *datum,
 }
 
 /* Initializes 'datum' as a string-to-string map whose contents are taken from
- * 'sh'.  Destroys 'sh'. */
+ * 'smap'.  Destroys 'smap'. */
 void
-ovsdb_datum_from_shash(struct ovsdb_datum *datum, struct shash *sh)
+ovsdb_datum_from_smap(struct ovsdb_datum *datum, struct smap *smap)
 {
-    struct shash_node *node, *next;
+    struct smap_node *node, *next;
     size_t i;
 
-    datum->n = shash_count(sh);
+    datum->n = smap_count(smap);
     datum->keys = xmalloc(datum->n * sizeof *datum->keys);
     datum->values = xmalloc(datum->n * sizeof *datum->values);
 
     i = 0;
-    SHASH_FOR_EACH_SAFE (node, next, sh) {
-        datum->keys[i].string = node->name;
-        datum->values[i].string = node->data;
-        shash_steal(sh, node);
+    SMAP_FOR_EACH_SAFE (node, next, smap) {
+        smap_steal(smap, node,
+                   &datum->keys[i].string, &datum->values[i].string);
         i++;
     }
     assert(i == datum->n);
 
-    shash_destroy(sh);
+    smap_destroy(smap);
     ovsdb_datum_sort_unique(datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
 }