• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /*
3  * Copyright (C) 2021-2024 Cyril Hrubis <metan@ucw.cz>
4  */
5 
6 #include <stdio.h>
7 #include "ujson_common.h"
8 
ujson_err_handler(void * err_print_priv,const char * line)9 void ujson_err_handler(void *err_print_priv, const char *line)
10 {
11 	fputs(line, err_print_priv);
12 	putc('\n', err_print_priv);
13 }
14 
ujson_type_name(enum ujson_type type)15 const char *ujson_type_name(enum ujson_type type)
16 {
17 	switch (type) {
18 	case UJSON_VOID:
19 		return "void";
20 	case UJSON_INT:
21 		return "integer";
22 	case UJSON_FLOAT:
23 		return "float";
24 	case UJSON_BOOL:
25 		return "boolean";
26 	case UJSON_NULL:
27 		return "null";
28 	case UJSON_STR:
29 		return "string";
30 	case UJSON_OBJ:
31 		return "object";
32 	case UJSON_ARR:
33 		return "array";
34 	default:
35 		return "invalid";
36 	}
37 }
38