ucl_internal.h (1709ccf9d38a5753192420ce5fccd93b04ce4d07) ucl_internal.h (b04a7a0baf6523245034b8ccd06cd0176b8a18cf)
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright

--- 31 unchanged lines hidden (view full) ---

40#define HAVE_STDIO_H
41#define HAVE_STRING_H
42#define HAVE_FLOAT_H
43#define HAVE_LIBGEN_H
44#define HAVE_MATH_H
45#define HAVE_STDBOOL_H
46#define HAVE_STDINT_H
47#define HAVE_STDARG_H
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright

--- 31 unchanged lines hidden (view full) ---

40#define HAVE_STDIO_H
41#define HAVE_STRING_H
42#define HAVE_FLOAT_H
43#define HAVE_LIBGEN_H
44#define HAVE_MATH_H
45#define HAVE_STDBOOL_H
46#define HAVE_STDINT_H
47#define HAVE_STDARG_H
48#define HAVE_REGEX_H
48#ifndef _WIN32
49# define HAVE_REGEX_H
49#endif
50#endif
51#endif
50
51#ifdef HAVE_SYS_TYPES_H
52#include <sys/types.h>
53#endif
54
55#ifdef HAVE_SYS_MMAN_H
56# ifndef _WIN32
57# include <sys/mman.h>

--- 34 unchanged lines hidden (view full) ---

92#include "ucl.h"
93#include "ucl_hash.h"
94#include "xxhash.h"
95
96#ifdef HAVE_OPENSSL
97#include <openssl/evp.h>
98#endif
99
52
53#ifdef HAVE_SYS_TYPES_H
54#include <sys/types.h>
55#endif
56
57#ifdef HAVE_SYS_MMAN_H
58# ifndef _WIN32
59# include <sys/mman.h>

--- 34 unchanged lines hidden (view full) ---

94#include "ucl.h"
95#include "ucl_hash.h"
96#include "xxhash.h"
97
98#ifdef HAVE_OPENSSL
99#include <openssl/evp.h>
100#endif
101
102#ifndef __DECONST
103#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
104#endif
105
100/**
101 * @file rcl_internal.h
102 * Internal structures and functions of UCL library
103 */
104
105#define UCL_MAX_RECURSION 16
106#define UCL_TRASH_KEY 0
107#define UCL_TRASH_VALUE 1

--- 201 unchanged lines hidden (view full) ---

309 * @param allow_double allow parsing of floating point values
310 * @return 0 if string is numeric and error code (EINVAL or ERANGE) in case of conversion error
311 */
312int ucl_maybe_parse_number (ucl_object_t *obj,
313 const char *start, const char *end, const char **pos,
314 bool allow_double, bool number_bytes, bool allow_time);
315
316
106/**
107 * @file rcl_internal.h
108 * Internal structures and functions of UCL library
109 */
110
111#define UCL_MAX_RECURSION 16
112#define UCL_TRASH_KEY 0
113#define UCL_TRASH_VALUE 1

--- 201 unchanged lines hidden (view full) ---

315 * @param allow_double allow parsing of floating point values
316 * @return 0 if string is numeric and error code (EINVAL or ERANGE) in case of conversion error
317 */
318int ucl_maybe_parse_number (ucl_object_t *obj,
319 const char *start, const char *end, const char **pos,
320 bool allow_double, bool number_bytes, bool allow_time);
321
322
317static inline ucl_object_t *
323static inline const ucl_object_t *
318ucl_hash_search_obj (ucl_hash_t* hashlin, ucl_object_t *obj)
319{
324ucl_hash_search_obj (ucl_hash_t* hashlin, ucl_object_t *obj)
325{
320 return (ucl_object_t *)ucl_hash_search (hashlin, obj->key, obj->keylen);
326 return (const ucl_object_t *)ucl_hash_search (hashlin, obj->key, obj->keylen);
321}
322
323static inline ucl_hash_t *
327}
328
329static inline ucl_hash_t *
324ucl_hash_insert_object (ucl_hash_t *hashlin, ucl_object_t *obj) UCL_WARN_UNUSED_RESULT;
330ucl_hash_insert_object (ucl_hash_t *hashlin, const ucl_object_t *obj) UCL_WARN_UNUSED_RESULT;
325
326static inline ucl_hash_t *
331
332static inline ucl_hash_t *
327ucl_hash_insert_object (ucl_hash_t *hashlin, ucl_object_t *obj)
333ucl_hash_insert_object (ucl_hash_t *hashlin, const ucl_object_t *obj)
328{
329 if (hashlin == NULL) {
330 hashlin = ucl_hash_create ();
331 }
332 ucl_hash_insert (hashlin, obj, obj->key, obj->keylen);
333
334 return hashlin;
335}
336
337/**
338 * Emit a single object to string
339 * @param obj
340 * @return
341 */
334{
335 if (hashlin == NULL) {
336 hashlin = ucl_hash_create ();
337 }
338 ucl_hash_insert (hashlin, obj, obj->key, obj->keylen);
339
340 return hashlin;
341}
342
343/**
344 * Emit a single object to string
345 * @param obj
346 * @return
347 */
342unsigned char * ucl_object_emit_single_json (ucl_object_t *obj);
348unsigned char * ucl_object_emit_single_json (const ucl_object_t *obj);
343
344#endif /* UCL_INTERNAL_H_ */
349
350#endif /* UCL_INTERNAL_H_ */