vswitch: Fix typos in schema documentation.
[openvswitch] / ovsdb / ovsdb.c
index 46d06a0ffc1bbec04bbce2888429ca9e5e04da3f..e76544e36253347da7a33e7dcf9c20207d7ab345 100644 (file)
@@ -123,7 +123,7 @@ static bool
 is_valid_version(const char *s)
 {
     int n = -1;
-    sscanf(s, "%*[0-9].%*[0-9].%*[0-9]%n", &n);
+    ignore(sscanf(s, "%*[0-9].%*[0-9].%*[0-9]%n", &n));
     return n != -1 && s[n] == '\0';
 }
 
@@ -235,6 +235,23 @@ ovsdb_schema_to_json(const struct ovsdb_schema *schema)
 
     return json;
 }
+
+/* Returns true if 'a' and 'b' specify equivalent schemas, false if they
+ * differ. */
+bool
+ovsdb_schema_equal(const struct ovsdb_schema *a,
+                   const struct ovsdb_schema *b)
+{
+    /* This implementation is simple, stupid, and slow, but I doubt that it
+     * will ever require much maintenance. */
+    struct json *ja = ovsdb_schema_to_json(a);
+    struct json *jb = ovsdb_schema_to_json(b);
+    bool equals = json_equal(ja, jb);
+    json_destroy(ja);
+    json_destroy(jb);
+
+    return equals;
+}
 \f
 static void
 ovsdb_set_ref_table(const struct shash *tables,