aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2010-03-28 21:44:41 +0300
committerPetri Lehtinen <petri@digip.org>2010-03-28 21:44:41 +0300
commit4e63fcd55d874485071073f181dbfc5b9e196600 (patch)
tree8c1aa0262a7ee2cdd6cc5c56b06b76660fd2d45e /src
parent49880cbabeb597a9c748a3d5f37e9961a084dce3 (diff)
parent024106bbfbd7376656876aa8bd00a333d5ada10c (diff)
downloadjansson-4e63fcd55d874485071073f181dbfc5b9e196600.zip
jansson-4e63fcd55d874485071073f181dbfc5b9e196600.tar.gz
jansson-4e63fcd55d874485071073f181dbfc5b9e196600.tar.bz2
Merge branch '1.2'
Conflicts: configure.ac
Diffstat (limited to 'src')
-rw-r--r--src/hashtable.c2
-rw-r--r--src/jansson.h.in (renamed from src/jansson.h)21
-rw-r--r--src/load.c9
-rw-r--r--src/value.c3
4 files changed, 19 insertions, 16 deletions
diff --git a/src/hashtable.c b/src/hashtable.c
index 4b58b26..a312047 100644
--- a/src/hashtable.c
+++ b/src/hashtable.c
@@ -5,6 +5,8 @@
* it under the terms of the MIT license. See LICENSE for details.
*/
+#include <config.h>
+
#include <stdlib.h>
#include "hashtable.h"
diff --git a/src/jansson.h b/src/jansson.h.in
index 24b4949..4980d01 100644
--- a/src/jansson.h
+++ b/src/jansson.h.in
@@ -10,7 +10,10 @@
#include <stdio.h>
-#ifdef __cplusplus
+#ifndef __cplusplus
+#define JSON_INLINE @json_inline@
+#else
+#define JSON_INLINE inline
extern "C" {
#endif
@@ -56,7 +59,8 @@ json_t *json_true(void);
json_t *json_false(void);
json_t *json_null(void);
-static inline json_t *json_incref(json_t *json)
+static JSON_INLINE
+json_t *json_incref(json_t *json)
{
if(json && json->refcount != (unsigned int)-1)
++json->refcount;
@@ -66,7 +70,8 @@ static inline json_t *json_incref(json_t *json)
/* do not call json_delete directly */
void json_delete(json_t *json);
-static inline void json_decref(json_t *json)
+static JSON_INLINE
+void json_decref(json_t *json)
{
if(json && json->refcount != (unsigned int)-1 && --json->refcount == 0)
json_delete(json);
@@ -89,13 +94,13 @@ const char *json_object_iter_key(void *iter);
json_t *json_object_iter_value(void *iter);
int json_object_iter_set_new(json_t *object, void *iter, json_t *value);
-static inline
+static JSON_INLINE
int json_object_set(json_t *object, const char *key, json_t *value)
{
return json_object_set_new(object, key, json_incref(value));
}
-static inline
+static JSON_INLINE
int json_object_set_nocheck(json_t *object, const char *key, json_t *value)
{
return json_object_set_new_nocheck(object, key, json_incref(value));
@@ -116,19 +121,19 @@ int json_array_remove(json_t *array, unsigned int index);
int json_array_clear(json_t *array);
int json_array_extend(json_t *array, json_t *other);
-static inline
+static JSON_INLINE
int json_array_set(json_t *array, unsigned int index, json_t *value)
{
return json_array_set_new(array, index, json_incref(value));
}
-static inline
+static JSON_INLINE
int json_array_append(json_t *array, json_t *value)
{
return json_array_append_new(array, json_incref(value));
}
-static inline
+static JSON_INLINE
int json_array_insert(json_t *array, unsigned int index, json_t *value)
{
return json_array_insert_new(array, index, json_incref(value));
diff --git a/src/load.c b/src/load.c
index baf3183..649609a 100644
--- a/src/load.c
+++ b/src/load.c
@@ -483,14 +483,7 @@ static int lex_scan_number(lex_t *lex, char c, json_error_t *error)
value = strtod(saved_text, &end);
assert(end == saved_text + lex->saved_text.length);
- if(value == 0 && errno == ERANGE) {
- error_set(error, lex, "real number underflow");
- goto out;
- }
-
- /* Cannot test for +/-HUGE_VAL because the HUGE_VAL constant is
- only defined in C99 mode. So let's trust in sole errno. */
- else if(errno == ERANGE) {
+ if(errno == ERANGE && value != 0) {
error_set(error, lex, "real number overflow");
goto out;
}
diff --git a/src/value.c b/src/value.c
index 7c41c89..e024fdb 100644
--- a/src/value.c
+++ b/src/value.c
@@ -6,6 +6,9 @@
*/
#define _GNU_SOURCE
+
+#include <config.h>
+
#include <stdlib.h>
#include <string.h>