Create a bunch of objects as demonstration. */
| 107 | |
| 108 | /* Create a bunch of objects as demonstration. */ |
| 109 | static void create_objects(void) |
| 110 | { |
| 111 | /* declare a few. */ |
| 112 | cJSON *root = NULL; |
| 113 | cJSON *fmt = NULL; |
| 114 | cJSON *img = NULL; |
| 115 | cJSON *thm = NULL; |
| 116 | cJSON *fld = NULL; |
| 117 | int i = 0; |
| 118 | |
| 119 | /* Our "days of the week" array: */ |
| 120 | const char *strings[7] = |
| 121 | { |
| 122 | "Sunday", |
| 123 | "Monday", |
| 124 | "Tuesday", |
| 125 | "Wednesday", |
| 126 | "Thursday", |
| 127 | "Friday", |
| 128 | "Saturday" |
| 129 | }; |
| 130 | /* Our matrix: */ |
| 131 | int numbers[3][3] = |
| 132 | { |
| 133 | {0, -1, 0}, |
| 134 | {1, 0, 0}, |
| 135 | {0 ,0, 1} |
| 136 | }; |
| 137 | /* Our "gallery" item: */ |
| 138 | int ids[4] = { 116, 943, 234, 38793 }; |
| 139 | /* Our array of "records": */ |
| 140 | struct record fields[2] = |
| 141 | { |
| 142 | { |
| 143 | "zip", |
| 144 | 37.7668, |
| 145 | -1.223959e+2, |
| 146 | "", |
| 147 | "SAN FRANCISCO", |
| 148 | "CA", |
| 149 | "94107", |
| 150 | "US" |
| 151 | }, |
| 152 | { |
| 153 | "zip", |
| 154 | 37.371991, |
| 155 | -1.22026e+2, |
| 156 | "", |
| 157 | "SUNNYVALE", |
| 158 | "CA", |
| 159 | "94085", |
| 160 | "US" |
| 161 | } |
| 162 | }; |
| 163 | volatile double zero = 0.0; |
| 164 | |
| 165 | /* Here we construct some JSON standards, from the JSON site. */ |
| 166 |
no test coverage detected
searching dependent graphs…