aboutsummaryrefslogtreecommitdiff
path: root/src/value.c
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2009-09-07 21:40:14 +0300
committerPetri Lehtinen <petri@digip.org>2009-09-07 21:40:14 +0300
commit7ee974e91c05d334b3a186937916bc843c537b8e (patch)
treedee16ab78cc4162e393d7da61dcc776c492e8fcf /src/value.c
parentc288188a0fd2d7ae5cc38c7c2b3ce326f15c25f9 (diff)
downloadjansson-7ee974e91c05d334b3a186937916bc843c537b8e.zip
jansson-7ee974e91c05d334b3a186937916bc843c537b8e.tar.gz
jansson-7ee974e91c05d334b3a186937916bc843c537b8e.tar.bz2
Don't perform reference counting on true, false and null
This makes their constructors thread safe. A special reference count -1 is used to test whether to perform reference counting on a value or not.
Diffstat (limited to 'src/value.c')
-rw-r--r--src/value.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/value.c b/src/value.c
index c84bfd3..29f787c 100644
--- a/src/value.c
+++ b/src/value.c
@@ -431,9 +431,9 @@ json_t *json_true(void)
{
static json_t the_true = {
.type = JSON_TRUE,
- .refcount = 1
+ .refcount = (unsigned int)1
};
- return json_incref(&the_true);
+ return &the_true;
}
@@ -441,9 +441,9 @@ json_t *json_false(void)
{
static json_t the_false = {
.type = JSON_FALSE,
- .refcount = 1
+ .refcount = (unsigned int)1
};
- return json_incref(&the_false);
+ return &the_false;
}
@@ -451,9 +451,9 @@ json_t *json_null(void)
{
static json_t the_null = {
.type = JSON_NULL,
- .refcount = 1
+ .refcount = (unsigned int)1
};
- return json_incref(&the_null);
+ return &the_null;
}