/*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 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.
}
}
-static void
+static size_t
print_and_free_json(struct json *json)
{
char *string = json_to_string(json, JSSF_SORT);
+ size_t length = strlen(string);
json_destroy(json);
puts(string);
free(string);
+
+ return length;
}
static void
if (error) {
print_and_free_ovsdb_error(error);
} else {
- print_and_free_json(ovsdb_atom_to_json(&atom, base.type));
+ size_t length;
+
+ length = print_and_free_json(ovsdb_atom_to_json(&atom, base.type));
+ ovs_assert(length == ovsdb_atom_json_length(&atom, base.type));
ovsdb_atom_destroy(&atom, base.type);
}
}
for (i = 2; i < argc; i++) {
struct ovsdb_datum datum;
+ size_t length;
json = unbox_json(parse_json(argv[i]));
check_ovsdb_error(parse(&datum, &type, json, NULL));
json_destroy(json);
- print_and_free_json(ovsdb_datum_to_json(&datum, &type));
+ length = print_and_free_json(ovsdb_datum_to_json(&datum, &type));
+ ovs_assert(length == ovsdb_datum_json_length(&datum, &type));
ovsdb_datum_destroy(&datum, &type);
}
idltest_init();
- idl = ovsdb_idl_create(argv[1], &idltest_idl_class, true);
+ idl = ovsdb_idl_create(argv[1], &idltest_idl_class, true, true);
if (argc > 2) {
struct stream *stream;