Permalink
Browse files

stylistic fixes

  • Loading branch information...
1 parent 22f5057 commit e7c3322662fbc0c397c5558e2470047d3afa8109 @richcarl richcarl committed with Eric Merritt Jul 22, 2010
View
46 chapter_12/plain_port/json_parser/c_src/jp_prog.c
@@ -12,18 +12,18 @@
#define BUFSIZE 65536
/* yajl callback prototypes */
-static int handle_null(void * ctx);
-static int handle_boolean(void * ctx, int boolean);
-static int handle_integer(void * ctx, long integerVal);
-static int handle_double(void * ctx, double doubleVal);
-static int handle_string(void * ctx, const unsigned char * stringVal,
+static int handle_null(void *ctx);
+static int handle_boolean(void *ctx, int boolVal);
+static int handle_integer(void *ctx, long integerVal);
+static int handle_double(void *ctx, double doubleVal);
+static int handle_string(void *ctx, const unsigned char *stringVal,
unsigned int stringLen);
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
unsigned int stringLen);
-static int handle_start_map(void * ctx);
-static int handle_end_map(void * ctx);
-static int handle_start_array(void * ctx);
-static int handle_end_array(void * ctx);
+static int handle_start_map(void *ctx);
+static int handle_end_map(void *ctx);
+static int handle_start_array(void *ctx);
+static int handle_end_array(void *ctx);
static yajl_callbacks callbacks = {
handle_null,
@@ -199,39 +199,39 @@ static void count_element(state_t *st)
if (c != NULL) ++(c->count);
}
-static int handle_null(void * ctx)
+static int handle_null(void *ctx)
{
state_t *st = (state_t *)ctx;
count_element(st);
ei_x_encode_atom(&st->x, "undefined");
return 1;
}
-static int handle_boolean(void * ctx, int boolean)
+static int handle_boolean(void *ctx, int boolVal)
{
state_t *st = (state_t *)ctx;
count_element(st);
- ei_x_encode_boolean(&st->x, boolean);
+ ei_x_encode_boolean(&st->x, boolVal);
return 1;
}
-static int handle_integer(void * ctx, long integerVal)
+static int handle_integer(void *ctx, long integerVal)
{
state_t *st = (state_t *)ctx;
count_element(st);
ei_x_encode_long(&st->x, integerVal);
return 1;
}
-static int handle_double(void * ctx, double doubleVal)
+static int handle_double(void *ctx, double doubleVal)
{
state_t *st = (state_t *)ctx;
count_element(st);
ei_x_encode_double(&st->x, doubleVal);
return 1;
}
-static int handle_string(void * ctx, const unsigned char * stringVal,
+static int handle_string(void *ctx, const unsigned char *stringVal,
unsigned int stringLen)
{
state_t *st = (state_t *)ctx;
@@ -240,7 +240,7 @@ static int handle_string(void * ctx, const unsigned char * stringVal,
return 1;
}
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
unsigned int stringLen)
{
state_t *st = (state_t *)ctx;
@@ -252,7 +252,7 @@ static int handle_map_key(void * ctx, const unsigned char * stringVal,
return 1;
}
-static int handle_start(void * ctx, int array)
+static int handle_start(void *ctx, int array)
{
state_t *st = (state_t *)ctx;
container_t *c = malloc(sizeof(container_t));
@@ -271,17 +271,17 @@ static int handle_start(void * ctx, int array)
return 1;
}
-static int handle_start_map(void * ctx)
+static int handle_start_map(void *ctx)
{
return handle_start(ctx, 0);
}
-static int handle_start_array(void * ctx)
+static int handle_start_array(void *ctx)
{
return handle_start(ctx, 1);
}
-static int handle_end(void * ctx, int array)
+static int handle_end(void *ctx, int array)
{
state_t *st = (state_t *)ctx;
container_t *c = st->c;
@@ -299,12 +299,12 @@ static int handle_end(void * ctx, int array)
return 1;
}
-static int handle_end_map(void * ctx)
+static int handle_end_map(void *ctx)
{
return handle_end(ctx, 0);
}
-static int handle_end_array(void * ctx)
+static int handle_end_array(void *ctx)
{
return handle_end(ctx, 1);
}
View
46 chapter_12/port_driver/json_parser/c_src/jp_driver.c
@@ -11,18 +11,18 @@
#include <yajl/yajl_parse.h>
/* yajl callback prototypes */
-static int handle_null(void * ctx);
-static int handle_boolean(void * ctx, int boolean);
-static int handle_integer(void * ctx, long integerVal);
-static int handle_double(void * ctx, double doubleVal);
-static int handle_string(void * ctx, const unsigned char * stringVal,
+static int handle_null(void *ctx);
+static int handle_boolean(void *ctx, int boolVal);
+static int handle_integer(void *ctx, long integerVal);
+static int handle_double(void *ctx, double doubleVal);
+static int handle_string(void *ctx, const unsigned char *stringVal,
unsigned int stringLen);
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
unsigned int stringLen);
-static int handle_start_map(void * ctx);
-static int handle_end_map(void * ctx);
-static int handle_start_array(void * ctx);
-static int handle_end_array(void * ctx);
+static int handle_start_map(void *ctx);
+static int handle_end_map(void *ctx);
+static int handle_start_array(void *ctx);
+static int handle_end_array(void *ctx);
static yajl_callbacks callbacks = {
handle_null,
@@ -218,39 +218,39 @@ static void count_element(state_t *st)
if (c != NULL) ++(c->count);
}
-static int handle_null(void * ctx)
+static int handle_null(void *ctx)
{
state_t *st = (state_t *)ctx;
count_element(st);
ei_x_encode_atom(&st->x, "undefined");
return 1;
}
-static int handle_boolean(void * ctx, int boolean)
+static int handle_boolean(void *ctx, int boolVal)
{
state_t *st = (state_t *)ctx;
count_element(st);
- ei_x_encode_boolean(&st->x, boolean);
+ ei_x_encode_boolean(&st->x, boolVal);
return 1;
}
-static int handle_integer(void * ctx, long integerVal)
+static int handle_integer(void *ctx, long integerVal)
{
state_t *st = (state_t *)ctx;
count_element(st);
ei_x_encode_long(&st->x, integerVal);
return 1;
}
-static int handle_double(void * ctx, double doubleVal)
+static int handle_double(void *ctx, double doubleVal)
{
state_t *st = (state_t *)ctx;
count_element(st);
ei_x_encode_double(&st->x, doubleVal);
return 1;
}
-static int handle_string(void * ctx, const unsigned char * stringVal,
+static int handle_string(void *ctx, const unsigned char *stringVal,
unsigned int stringLen)
{
state_t *st = (state_t *)ctx;
@@ -259,7 +259,7 @@ static int handle_string(void * ctx, const unsigned char * stringVal,
return 1;
}
-static int handle_map_key(void * ctx, const unsigned char * stringVal,
+static int handle_map_key(void *ctx, const unsigned char *stringVal,
unsigned int stringLen)
{
state_t *st = (state_t *)ctx;
@@ -271,7 +271,7 @@ static int handle_map_key(void * ctx, const unsigned char * stringVal,
return 1;
}
-static int handle_start(void * ctx, int array)
+static int handle_start(void *ctx, int array)
{
state_t *st = (state_t *)ctx;
container_t *c = driver_alloc(sizeof(container_t));
@@ -290,17 +290,17 @@ static int handle_start(void * ctx, int array)
return 1;
}
-static int handle_start_map(void * ctx)
+static int handle_start_map(void *ctx)
{
return handle_start(ctx, 0);
}
-static int handle_start_array(void * ctx)
+static int handle_start_array(void *ctx)
{
return handle_start(ctx, 1);
}
-static int handle_end(void * ctx, int array)
+static int handle_end(void *ctx, int array)
{
state_t *st = (state_t *)ctx;
container_t *c = st->c;
@@ -318,12 +318,12 @@ static int handle_end(void * ctx, int array)
return 1;
}
-static int handle_end_map(void * ctx)
+static int handle_end_map(void *ctx)
{
return handle_end(ctx, 0);
}
-static int handle_end_array(void * ctx)
+static int handle_end_array(void *ctx)
{
return handle_end(ctx, 1);
}

0 comments on commit e7c3322

Please sign in to comment.