forked from signalwire/freeswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch_json.c
More file actions
40 lines (30 loc) · 723 Bytes
/
Copy pathswitch_json.c
File metadata and controls
40 lines (30 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "switch.h"
SWITCH_DECLARE(cJSON *) cJSON_CreateStringPrintf(const char *fmt, ...)
{
va_list ap;
char *str;
cJSON *item;
va_start(ap, fmt);
str = switch_vmprintf(fmt, ap);
va_end(ap);
if (!str) return NULL;
item = cJSON_CreateString(str);
free(str);
return item;
}
SWITCH_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char *string)
{
cJSON *cj = cJSON_GetObjectItem(object, string);
if (!cj || cj->type != cJSON_String || !cj->valuestring) return NULL;
return cj->valuestring;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/