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 #include "args.h"
30
31 #include <stdio.h>
32
33 #include "toolkit.h"
34 #include "../common/utils.h"
35
36 void ui_argstr_add_int(CxBuffer *buf,
const char *name,
int i) {
37 char n[
32];
38 snprintf(n,
32,
"%i", i);
39
40 cxBufferPutString(buf,
"\"");
41 cxBufferPutString(buf, name);
42 cxBufferPutString(buf,
"\":");
43 cxBufferPutString(buf, n);
44 cxBufferPutString(buf,
",");
45 }
46
47 void ui_argstr_add_str(CxBuffer *buf,
const char *name,
const char *value) {
48 cxmutstr value_escaped = ui_escape_string(cx_str(value));
49 cxBufferPutString(buf,
"\"");
50 cxBufferPutString(buf, name);
51 cxBufferPutString(buf,
"\":\"");
52 cxBufferPutString(buf, value_escaped.ptr);
53 cxBufferPutString(buf,
"\",");
54 if(value != value_escaped.ptr) {
55 free(value_escaped.ptr);
56 }
57 }
58