aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2010-03-23 08:08:57 +0200
committerPetri Lehtinen <petri@digip.org>2010-03-23 08:12:32 +0200
commitf284e3c069abcdfc1145e939b0c284910c274d17 (patch)
treee322c9831765e07ce6a39a6da2fa762a15f8d909 /src
parenta2a9107600da8ed0302e414fef8b9e70233e71ca (diff)
downloadjansson-f284e3c069abcdfc1145e939b0c284910c274d17.zip
jansson-f284e3c069abcdfc1145e939b0c284910c274d17.tar.gz
jansson-f284e3c069abcdfc1145e939b0c284910c274d17.tar.bz2
Fix reference counting on true, false and null
Initialize their reference counts to (unsigned int)-1 to disable reference counting on them. It already was meant to work like this, but the reference counts were just initialized to 1 instead of -1. Thanks to Andrew Thompson for reporting this issue.
Diffstat (limited to 'src')
-rw-r--r--src/value.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/value.c b/src/value.c
index 345ff8e..3fa7ee3 100644
--- a/src/value.c
+++ b/src/value.c
@@ -784,7 +784,7 @@ json_t *json_true(void)
{
static json_t the_true = {
.type = JSON_TRUE,
- .refcount = (unsigned int)1
+ .refcount = (unsigned int)-1
};
return &the_true;
}
@@ -794,7 +794,7 @@ json_t *json_false(void)
{
static json_t the_false = {
.type = JSON_FALSE,
- .refcount = (unsigned int)1
+ .refcount = (unsigned int)-1
};
return &the_false;
}
@@ -804,7 +804,7 @@ json_t *json_null(void)
{
static json_t the_null = {
.type = JSON_NULL,
- .refcount = (unsigned int)1
+ .refcount = (unsigned int)-1
};
return &the_null;
}