summaryrefslogtreecommitdiff
path: root/lib/json.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-11-06 13:14:55 -0800
committerBen Pfaff <blp@nicira.com>2013-01-16 16:03:37 -0800
commitcb22974d773942d66da42b700b8bca0db27a0920 (patch)
tree6412724be1bfc46d7235c4e2105c279bbe20d320 /lib/json.c
parent4749f73d12c844b318af7f45cf45e1acac9f7c08 (diff)
downloadopenvswitch-cb22974d773942d66da42b700b8bca0db27a0920.tar.gz
Replace most uses of assert by ovs_assert.
This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/json.c')
-rw-r--r--lib/json.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/json.c b/lib/json.c
index f0b6456aa..5c968518f 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -18,7 +18,6 @@
#include "json.h"
-#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
@@ -288,42 +287,42 @@ json_object_put_string(struct json *json, const char *name, const char *value)
const char *
json_string(const struct json *json)
{
- assert(json->type == JSON_STRING);
+ ovs_assert(json->type == JSON_STRING);
return json->u.string;
}
struct json_array *
json_array(const struct json *json)
{
- assert(json->type == JSON_ARRAY);
+ ovs_assert(json->type == JSON_ARRAY);
return CONST_CAST(struct json_array *, &json->u.array);
}
struct shash *
json_object(const struct json *json)
{
- assert(json->type == JSON_OBJECT);
+ ovs_assert(json->type == JSON_OBJECT);
return CONST_CAST(struct shash *, json->u.object);
}
bool
json_boolean(const struct json *json)
{
- assert(json->type == JSON_TRUE || json->type == JSON_FALSE);
+ ovs_assert(json->type == JSON_TRUE || json->type == JSON_FALSE);
return json->type == JSON_TRUE;
}
double
json_real(const struct json *json)
{
- assert(json->type == JSON_REAL || json->type == JSON_INTEGER);
+ ovs_assert(json->type == JSON_REAL || json->type == JSON_INTEGER);
return json->type == JSON_REAL ? json->u.real : json->u.integer;
}
int64_t
json_integer(const struct json *json)
{
- assert(json->type == JSON_INTEGER);
+ ovs_assert(json->type == JSON_INTEGER);
return json->u.integer;
}
@@ -1130,8 +1129,8 @@ json_parser_finish(struct json_parser *p)
}
if (!p->error) {
- assert(p->height == 1);
- assert(p->stack[0].json != NULL);
+ ovs_assert(p->height == 1);
+ ovs_assert(p->stack[0].json != NULL);
json = p->stack[--p->height].json;
} else {
json = json_string_create_nocopy(p->error);