-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2011 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
parser->name = xvasprintf(name, args);
va_end(args);
- svec_init(&parser->used);
+ sset_init(&parser->used);
parser->error = NULL;
parser->json = (json && json->type == JSON_OBJECT ? json : NULL);
|| (types & OP_ID && value->type == JSON_STRING
&& ovsdb_parser_is_id(value->u.string)))
{
- svec_add(&parser->used, name);
+ sset_add(&parser->used, name);
return value;
} else {
ovsdb_parser_raise_error(parser, "Type mismatch for member '%s'.",
const struct shash *object = json_object(parser->json);
size_t n_unused;
- /* XXX this method of detecting unused members can be made cheaper */
- svec_sort_unique(&parser->used);
- n_unused = shash_count(object) - parser->used.n;
+ n_unused = shash_count(object) - sset_count(&parser->used);
if (n_unused) {
struct shash_node *node;
SHASH_FOR_EACH (node, object) {
- if (!svec_contains(&parser->used, node->name)) {
+ if (!sset_contains(&parser->used, node->name)) {
if (n_unused > 1) {
ovsdb_parser_raise_error(
parser,
}
free(parser->name);
- svec_destroy(&parser->used);
+ sset_destroy(&parser->used);
return parser->error;
}
-/* Copyright (c) 2009, 2010 Nicira Networks
+/* Copyright (c) 2009, 2010, 2011 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <stdbool.h>
#include "compiler.h"
#include "json.h"
-#include "svec.h"
+#include "sset.h"
#include "util.h"
struct ovsdb_parser {
char *name; /* Used only in error messages. */
- struct svec used; /* Already-parsed names from 'object'. */
+ struct sset used; /* Already-parsed names from 'object'. */
const struct json *json; /* JSON object being parsed. */
struct ovsdb_error *error; /* Error signaled, if any. */
};