Clarify and document the integer type configuration
This commit is contained in:
parent
bfac1972e2
commit
b76c69de1b
@ -296,9 +296,21 @@ Number
|
|||||||
|
|
||||||
Usually, you can safely use plain ``int`` in place of
|
Usually, you can safely use plain ``int`` in place of
|
||||||
``json_int_t``, and the implicit C integer conversion handles the
|
``json_int_t``, and the implicit C integer conversion handles the
|
||||||
rest. Only when you know that you need a full 64-bit range, you
|
rest. Only when you know that you need the full 64-bit range, you
|
||||||
should use ``json_int_t`` explicitly.
|
should use ``json_int_t`` explicitly.
|
||||||
|
|
||||||
|
``JSON_INTEGER_IS_LONG_LONG``
|
||||||
|
|
||||||
|
This is a preprocessor variable that holds the value 1 if
|
||||||
|
:ctype:`json_int_t` is ``long long``, and 0 if it's ``long``. It
|
||||||
|
can be used as follows::
|
||||||
|
|
||||||
|
#if JSON_INTEGER_IS_LONG_LONG
|
||||||
|
/* Code specific for long long */
|
||||||
|
#else
|
||||||
|
/* Code specific for long */
|
||||||
|
#endif
|
||||||
|
|
||||||
``JSON_INTEGER_FORMAT``
|
``JSON_INTEGER_FORMAT``
|
||||||
|
|
||||||
This is a macro that expands to a :cfunc:`printf()` conversion
|
This is a macro that expands to a :cfunc:`printf()` conversion
|
||||||
|
@ -11,29 +11,24 @@
|
|||||||
*
|
*
|
||||||
* The configure script copies this file to jansson_config.h and
|
* The configure script copies this file to jansson_config.h and
|
||||||
* replaces @var@ substitutions by values that fit your system. If you
|
* replaces @var@ substitutions by values that fit your system. If you
|
||||||
* cannot run the configure script, you can copy the file and do the
|
* cannot run the configure script, you can do the value substitution
|
||||||
* value substitution by hand.
|
* by hand.
|
||||||
*
|
|
||||||
* See below for explanations of each substitution variable.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef JANSSON_CONFIG_H
|
#ifndef JANSSON_CONFIG_H
|
||||||
#define JANSSON_CONFIG_H
|
#define JANSSON_CONFIG_H
|
||||||
|
|
||||||
|
/* If your compiler supports the inline keyword in C, JSON_INLINE is
|
||||||
|
defined to `inline', otherwise empty. In C++, the inline is always
|
||||||
|
supported. */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define JSON_INLINE inline
|
#define JSON_INLINE inline
|
||||||
#else
|
#else
|
||||||
/* If your compiler supports the inline keyword, @json_inline@ is
|
|
||||||
replaced with `inline', otherwise empty. */
|
|
||||||
#define JSON_INLINE @json_inline@
|
#define JSON_INLINE @json_inline@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If your compiler supports the `long long` type,
|
/* If your compiler supports the `long long` type,
|
||||||
@json_have_long_long@ is replaced with 1, otherwise with 0. */
|
JSON_INTEGER_IS_LONG_LONG is defined to 1, otherwise to 0. */
|
||||||
#if @json_have_long_long@
|
#define JSON_INTEGER_IS_LONG_LONG @json_have_long_long@
|
||||||
#define JSON_INTEGER_IS_LONG_LONG 1
|
|
||||||
#else
|
|
||||||
#define JSON_INTEGER_IS_LONG 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -401,7 +401,7 @@ out:
|
|||||||
free(lex->value.string);
|
free(lex->value.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JSON_INTEGER_IS_LONG_LONG
|
#if JSON_INTEGER_IS_LONG_LONG
|
||||||
#define json_strtoint strtoll
|
#define json_strtoint strtoll
|
||||||
#else
|
#else
|
||||||
#define json_strtoint strtol
|
#define json_strtoint strtol
|
||||||
|
Loading…
Reference in New Issue
Block a user