git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prepare for post-2.2.0 (2.2.90).
[sliver-openvswitch.git]
/
lib
/
ovsdb-parser.c
diff --git
a/lib/ovsdb-parser.c
b/lib/ovsdb-parser.c
index
2a4c3d9
..
f4642ad
100644
(file)
--- a/
lib/ovsdb-parser.c
+++ b/
lib/ovsdb-parser.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2009
Nicira Networks
+/* Copyright (c) 2009
, 2011, 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.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-32,7
+32,7
@@
ovsdb_parser_init(struct ovsdb_parser *parser, const struct json *json,
parser->name = xvasprintf(name, args);
va_end(args);
parser->name = xvasprintf(name, args);
va_end(args);
- s
vec
_init(&parser->used);
+ s
set
_init(&parser->used);
parser->error = NULL;
parser->json = (json && json->type == JSON_OBJECT ? json : NULL);
parser->error = NULL;
parser->json = (json && json->type == JSON_OBJECT ? json : NULL);
@@
-80,12
+80,12
@@
ovsdb_parser_member(struct ovsdb_parser *parser, const char *name,
return NULL;
}
return NULL;
}
- if ((value->type >= 0 && value->type < JSON_N_TYPES
+ if ((
(int)
value->type >= 0 && value->type < JSON_N_TYPES
&& types & (1u << value->type))
|| (types & OP_ID && value->type == JSON_STRING
&& ovsdb_parser_is_id(value->u.string)))
{
&& types & (1u << value->type))
|| (types & OP_ID && value->type == JSON_STRING
&& ovsdb_parser_is_id(value->u.string)))
{
- s
vec
_add(&parser->used, name);
+ s
set
_add(&parser->used, name);
return value;
} else {
ovsdb_parser_raise_error(parser, "Type mismatch for member '%s'.",
return value;
} else {
ovsdb_parser_raise_error(parser, "Type mismatch for member '%s'.",
@@
-133,18
+133,16
@@
ovsdb_parser_finish(struct ovsdb_parser *parser)
const struct shash *object = json_object(parser->json);
size_t n_unused;
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 (n_unused) {
struct shash_node *node;
SHASH_FOR_EACH (node, object) {
- if (!s
vec
_contains(&parser->used, node->name)) {
+ if (!s
set
_contains(&parser->used, node->name)) {
if (n_unused > 1) {
ovsdb_parser_raise_error(
parser,
if (n_unused > 1) {
ovsdb_parser_raise_error(
parser,
- "Member '%s' and %
zu
other member%s "
+ "Member '%s' and %
"PRIuSIZE"
other member%s "
"are present but not allowed here.",
node->name, n_unused - 1, n_unused > 2 ? "s" : "");
} else {
"are present but not allowed here.",
node->name, n_unused - 1, n_unused > 2 ? "s" : "");
} else {
@@
-160,7
+158,7
@@
ovsdb_parser_finish(struct ovsdb_parser *parser)
}
free(parser->name);
}
free(parser->name);
- s
vec
_destroy(&parser->used);
+ s
set
_destroy(&parser->used);
return parser->error;
}
return parser->error;
}