Nyx Node
Loading...
Searching...
No Matches
json_null.c
1/* NyxNode
2 * Author: Jérôme ODIER <jerome.odier@lpsc.in2p3.fr>
3 * SPDX-License-Identifier: GPL-2.0-only (Mongoose backend) or GPL-3.0+
4 */
5
6/*--------------------------------------------------------------------------------------------------------------------*/
7
8#include "../nyx_node_internal.h"
9
10/*--------------------------------------------------------------------------------------------------------------------*/
11
12nyx_null_t *nyx_null_new(void)
13{
14 /*----------------------------------------------------------------------------------------------------------------*/
15
16 nyx_null_t *object = nyx_memory_alloc(sizeof(nyx_null_t));
17
18 /*----------------------------------------------------------------------------------------------------------------*/
19
20 object->base = NYX_OBJECT(NYX_TYPE_NULL);
21
22 /*----------------------------------------------------------------------------------------------------------------*/
23
24 return object;
25}
26
27/*--------------------------------------------------------------------------------------------------------------------*/
28
29void nyx_null_free(nyx_null_t *object)
30{
31 nyx_memory_free(object);
32}
33
34/*--------------------------------------------------------------------------------------------------------------------*/
35
36str_t nyx_null_to_string(__NYX_UNUSED__ const nyx_null_t *object)
37{
38 return nyx_string_dup("null");
39}
40
41/*--------------------------------------------------------------------------------------------------------------------*/
__NYX_NULLABLE__ buff_t nyx_memory_alloc(__NYX_ZEROABLE__ size_t size)
Similar to libc malloc except that a memory overflow causes the node to stop.
__NYX_ZEROABLE__ size_t nyx_memory_free(__NYX_NULLABLE__ buff_t buff)
Similar to libc free except that it returns the amount of memory freed.
__NYX_NULLABLE__ str_t nyx_string_dup(__NYX_NULLABLE__ STR_t s)
Similar to libc strdup.
#define str_t
Alias for char *.
Definition nyx_node.h:70
@ NYX_TYPE_NULL
Null object.
Definition nyx_node.h:422
Struct describing a JSON null object.
Definition nyx_node.h:630