summaryrefslogtreecommitdiffstats
path: root/c/jv.c
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2012-09-09 18:09:05 +0100
committerStephen Dolan <mu@netsoc.tcd.ie>2012-09-09 18:09:05 +0100
commita4ff3d4670b6a64f41569fa0f7ae1fba0781625f (patch)
treeed9271091943ca725f271e60bf0651531eb2266a /c/jv.c
parente6a85737daaefd0066b684ff6fd3d3c5a60b0ac0 (diff)
Bugfix for expanding objects.
Diffstat (limited to 'c/jv.c')
-rw-r--r--c/jv.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/c/jv.c b/c/jv.c
index c4a5af1c..1d5c9816 100644
--- a/c/jv.c
+++ b/c/jv.c
@@ -58,6 +58,10 @@ jv jv_null() {
return JV_NULL;
}
+jv jv_bool(int x) {
+ return x ? JV_TRUE : JV_FALSE;
+}
+
/*
* Numbers
*/
@@ -617,11 +621,12 @@ static jv* jvp_object_write(jv_complex* object, jvp_string* key) {
if (slot) {
// already has the key
jvp_string_free_p(key);
- } else {
- slot = jvp_object_add_slot(object, key, bucket);
- slot->value = jv_invalid();
+ return &slot->value;
}
- if (slot == 0) {
+ slot = jvp_object_add_slot(object, key, bucket);
+ if (slot) {
+ slot->value = jv_invalid();
+ } else {
jvp_object_rehash(object);
bucket = jvp_object_find_bucket(object, key);
assert(!jvp_object_find_slot(object, key, bucket));