Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

stylistic fixes

  • Loading branch information...
commit e7c3322662fbc0c397c5558e2470047d3afa8109 1 parent 22f5057
Richard Carlsson authored July 22, 2010 Eric Merritt committed August 10, 2010
46  chapter_12/plain_port/json_parser/c_src/jp_prog.c
@@ -12,18 +12,18 @@
12 12
 #define BUFSIZE 65536
13 13
 
14 14
 /* yajl callback prototypes */
15  
-static int handle_null(void * ctx);
16  
-static int handle_boolean(void * ctx, int boolean);
17  
-static int handle_integer(void * ctx, long integerVal);
18  
-static int handle_double(void * ctx, double doubleVal);
19  
-static int handle_string(void * ctx, const unsigned char * stringVal,
  15
+static int handle_null(void *ctx);
  16
+static int handle_boolean(void *ctx, int boolVal);
  17
+static int handle_integer(void *ctx, long integerVal);
  18
+static int handle_double(void *ctx, double doubleVal);
  19
+static int handle_string(void *ctx, const unsigned char *stringVal,
20 20
                          unsigned int stringLen);
21  
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
  21
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
22 22
                           unsigned int stringLen);
23  
-static int handle_start_map(void * ctx);
24  
-static int handle_end_map(void * ctx);
25  
-static int handle_start_array(void * ctx);
26  
-static int handle_end_array(void * ctx);
  23
+static int handle_start_map(void *ctx);
  24
+static int handle_end_map(void *ctx);
  25
+static int handle_start_array(void *ctx);
  26
+static int handle_end_array(void *ctx);
27 27
 
28 28
 static yajl_callbacks callbacks = {
29 29
   handle_null,
@@ -199,7 +199,7 @@ static void count_element(state_t *st)
199 199
   if (c != NULL) ++(c->count);
200 200
 }
201 201
 
202  
-static int handle_null(void * ctx)
  202
+static int handle_null(void *ctx)
203 203
 {
204 204
   state_t *st = (state_t *)ctx;
205 205
   count_element(st);
@@ -207,15 +207,15 @@ static int handle_null(void * ctx)
207 207
   return 1;
208 208
 }
209 209
 
210  
-static int handle_boolean(void * ctx, int boolean)
  210
+static int handle_boolean(void *ctx, int boolVal)
211 211
 {
212 212
   state_t *st = (state_t *)ctx;
213 213
   count_element(st);
214  
-  ei_x_encode_boolean(&st->x, boolean);
  214
+  ei_x_encode_boolean(&st->x, boolVal);
215 215
   return 1;
216 216
 }
217 217
 
218  
-static int handle_integer(void * ctx, long integerVal)
  218
+static int handle_integer(void *ctx, long integerVal)
219 219
 {
220 220
   state_t *st = (state_t *)ctx;
221 221
   count_element(st);
@@ -223,7 +223,7 @@ static int handle_integer(void * ctx, long integerVal)
223 223
   return 1;
224 224
 }
225 225
 
226  
-static int handle_double(void * ctx, double doubleVal)
  226
+static int handle_double(void *ctx, double doubleVal)
227 227
 {
228 228
   state_t *st = (state_t *)ctx;
229 229
   count_element(st);
@@ -231,7 +231,7 @@ static int handle_double(void * ctx, double doubleVal)
231 231
   return 1;
232 232
 }
233 233
 
234  
-static int handle_string(void * ctx, const unsigned char * stringVal,
  234
+static int handle_string(void *ctx, const unsigned char *stringVal,
235 235
                          unsigned int stringLen)
236 236
 {
237 237
   state_t *st = (state_t *)ctx;
@@ -240,7 +240,7 @@ static int handle_string(void * ctx, const unsigned char * stringVal,
240 240
   return 1;
241 241
 }
242 242
 
243  
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
  243
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
244 244
                           unsigned int stringLen)
245 245
 {
246 246
   state_t *st = (state_t *)ctx;
@@ -252,7 +252,7 @@ static int handle_map_key(void * ctx, const unsigned char * stringVal,
252 252
   return 1;
253 253
 }
254 254
 
255  
-static int handle_start(void * ctx, int array)
  255
+static int handle_start(void *ctx, int array)
256 256
 {
257 257
   state_t *st = (state_t *)ctx;
258 258
   container_t *c = malloc(sizeof(container_t));
@@ -271,17 +271,17 @@ static int handle_start(void * ctx, int array)
271 271
   return 1;
272 272
 }
273 273
 
274  
-static int handle_start_map(void * ctx)
  274
+static int handle_start_map(void *ctx)
275 275
 {
276 276
   return handle_start(ctx, 0);
277 277
 }
278 278
 
279  
-static int handle_start_array(void * ctx)
  279
+static int handle_start_array(void *ctx)
280 280
 {
281 281
   return handle_start(ctx, 1);
282 282
 }
283 283
 
284  
-static int handle_end(void * ctx, int array)
  284
+static int handle_end(void *ctx, int array)
285 285
 {
286 286
   state_t *st = (state_t *)ctx;
287 287
   container_t *c = st->c;
@@ -299,12 +299,12 @@ static int handle_end(void * ctx, int array)
299 299
   return 1;
300 300
 }
301 301
 
302  
-static int handle_end_map(void * ctx)
  302
+static int handle_end_map(void *ctx)
303 303
 {
304 304
   return handle_end(ctx, 0);
305 305
 }
306 306
 
307  
-static int handle_end_array(void * ctx)
  307
+static int handle_end_array(void *ctx)
308 308
 {
309 309
   return handle_end(ctx, 1);
310 310
 }
46  chapter_12/port_driver/json_parser/c_src/jp_driver.c
@@ -11,18 +11,18 @@
11 11
 #include <yajl/yajl_parse.h>
12 12
 
13 13
 /* yajl callback prototypes */
14  
-static int handle_null(void * ctx);
15  
-static int handle_boolean(void * ctx, int boolean);
16  
-static int handle_integer(void * ctx, long integerVal);
17  
-static int handle_double(void * ctx, double doubleVal);
18  
-static int handle_string(void * ctx, const unsigned char * stringVal,
  14
+static int handle_null(void *ctx);
  15
+static int handle_boolean(void *ctx, int boolVal);
  16
+static int handle_integer(void *ctx, long integerVal);
  17
+static int handle_double(void *ctx, double doubleVal);
  18
+static int handle_string(void *ctx, const unsigned char *stringVal,
19 19
                          unsigned int stringLen);
20  
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
  20
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
21 21
                           unsigned int stringLen);
22  
-static int handle_start_map(void * ctx);
23  
-static int handle_end_map(void * ctx);
24  
-static int handle_start_array(void * ctx);
25  
-static int handle_end_array(void * ctx);
  22
+static int handle_start_map(void *ctx);
  23
+static int handle_end_map(void *ctx);
  24
+static int handle_start_array(void *ctx);
  25
+static int handle_end_array(void *ctx);
26 26
 
27 27
 static yajl_callbacks callbacks = {
28 28
   handle_null,
@@ -218,7 +218,7 @@ static void count_element(state_t *st)
218 218
   if (c != NULL) ++(c->count);
219 219
 }
220 220
 
221  
-static int handle_null(void * ctx)
  221
+static int handle_null(void *ctx)
222 222
 {
223 223
   state_t *st = (state_t *)ctx;
224 224
   count_element(st);
@@ -226,15 +226,15 @@ static int handle_null(void * ctx)
226 226
   return 1;
227 227
 }
228 228
 
229  
-static int handle_boolean(void * ctx, int boolean)
  229
+static int handle_boolean(void *ctx, int boolVal)
230 230
 {
231 231
   state_t *st = (state_t *)ctx;
232 232
   count_element(st);
233  
-  ei_x_encode_boolean(&st->x, boolean);
  233
+  ei_x_encode_boolean(&st->x, boolVal);
234 234
   return 1;
235 235
 }
236 236
 
237  
-static int handle_integer(void * ctx, long integerVal)
  237
+static int handle_integer(void *ctx, long integerVal)
238 238
 {
239 239
   state_t *st = (state_t *)ctx;
240 240
   count_element(st);
@@ -242,7 +242,7 @@ static int handle_integer(void * ctx, long integerVal)
242 242
   return 1;
243 243
 }
244 244
 
245  
-static int handle_double(void * ctx, double doubleVal)
  245
+static int handle_double(void *ctx, double doubleVal)
246 246
 {
247 247
   state_t *st = (state_t *)ctx;
248 248
   count_element(st);
@@ -250,7 +250,7 @@ static int handle_double(void * ctx, double doubleVal)
250 250
   return 1;
251 251
 }
252 252
 
253  
-static int handle_string(void * ctx, const unsigned char * stringVal,
  253
+static int handle_string(void *ctx, const unsigned char *stringVal,
254 254
                          unsigned int stringLen)
255 255
 {
256 256
   state_t *st = (state_t *)ctx;
@@ -259,7 +259,7 @@ static int handle_string(void * ctx, const unsigned char * stringVal,
259 259
   return 1;
260 260
 }
261 261
 
262  
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
  262
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
263 263
                           unsigned int stringLen)
264 264
 {
265 265
   state_t *st = (state_t *)ctx;
@@ -271,7 +271,7 @@ static int handle_map_key(void * ctx, const unsigned char * stringVal,
271 271
   return 1;
272 272
 }
273 273
 
274  
-static int handle_start(void * ctx, int array)
  274
+static int handle_start(void *ctx, int array)
275 275
 {
276 276
   state_t *st = (state_t *)ctx;
277 277
   container_t *c = driver_alloc(sizeof(container_t));
@@ -290,17 +290,17 @@ static int handle_start(void * ctx, int array)
290 290
   return 1;
291 291
 }
292 292
 
293  
-static int handle_start_map(void * ctx)
  293
+static int handle_start_map(void *ctx)
294 294
 {
295 295
   return handle_start(ctx, 0);
296 296
 }
297 297
 
298  
-static int handle_start_array(void * ctx)
  298
+static int handle_start_array(void *ctx)
299 299
 {
300 300
   return handle_start(ctx, 1);
301 301
 }
302 302
 
303  
-static int handle_end(void * ctx, int array)
  303
+static int handle_end(void *ctx, int array)
304 304
 {
305 305
   state_t *st = (state_t *)ctx;
306 306
   container_t *c = st->c;
@@ -318,12 +318,12 @@ static int handle_end(void * ctx, int array)
318 318
   return 1;
319 319
 }
320 320
 
321  
-static int handle_end_map(void * ctx)
  321
+static int handle_end_map(void *ctx)
322 322
 {
323 323
   return handle_end(ctx, 0);
324 324
 }
325 325
 
326  
-static int handle_end_array(void * ctx)
  326
+static int handle_end_array(void *ctx)
327 327
 {
328 328
   return handle_end(ctx, 1);
329 329
 }

0 notes on commit e7c3322

Please sign in to comment.
Something went wrong with that request. Please try again.