Nyx Node
Toggle main menu visibility
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
12
nyx_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
29
void
nyx_null_free(
nyx_null_t
*
object
)
30
{
31
nyx_memory_free
(
object
);
32
}
33
34
/*--------------------------------------------------------------------------------------------------------------------*/
35
36
str_t
nyx_null_to_string(__NYX_UNUSED__
const
nyx_null_t
*
object
)
37
{
38
return
nyx_string_dup
(
"null"
);
39
}
40
41
/*--------------------------------------------------------------------------------------------------------------------*/
nyx_memory_alloc
__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_memory_free
__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_string_dup
__NYX_NULLABLE__ str_t nyx_string_dup(__NYX_NULLABLE__ STR_t s)
Similar to libc strdup.
str_t
#define str_t
Alias for char *.
Definition
nyx_node.h:70
nyx_null_t::nyx_null_new
nyx_null_t * nyx_null_new(void)
Allocates a new JSON null object.
Definition
json_null.c:12
nyx_null_t
Struct describing a JSON null object.
Definition
nyx_node.h:680
NYX_TYPE_NULL
@ NYX_TYPE_NULL
Null object.
Definition
nyx_node.h:434
Author:
Jérôme ODIER
License:
LGPL-3.0-or-later
Copyright:
LPSC / CNRS