Skip to content

Commit

Permalink
Remove pos_cur from examples and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mnunberg committed Nov 22, 2017
1 parent ad3e352 commit 684b60f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/glib-datatypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ dump_action_state(jsonsl_t jsn,
struct jsonsl_state_st *state)
{
int ii;
size_t pos = (action == JSONSL_ACTION_POP) ? state->pos_cur : state->pos_begin;
size_t pos = (action == JSONSL_ACTION_POP) ? jsn->pos : state->pos_begin;
if (!DumpProgress) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/jpr_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ static void pop_callback(jsonsl_t jsn,
{
struct lexer_global_st *global = (struct lexer_global_st*)jsn->data;
if (state->type == JSONSL_T_HKEY) {
global->hkey = at - (state->pos_cur - state->pos_begin);
global->hkey = at - (jsn->pos - state->pos_begin);
global->hkey++;
global->nhkey = (state->pos_cur - state->pos_begin)-1;
global->nhkey = (jsn->pos - state->pos_begin)-1;
printf("Got key..");
fwrite(global->hkey, 1, global->nhkey, stdout);
printf("\n");
Expand Down
2 changes: 1 addition & 1 deletion tests/json_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void state_callback(jsonsl_t jsn,
*/
/*
if (action == JSONSL_ACTION_POP) {
size_t state_len = state->pos_cur - state->pos_begin;
size_t state_len = jsn->pos - state->pos_begin;
}
*/
}
Expand Down
4 changes: 2 additions & 2 deletions tests/match_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ pop_callback(jsonsl_t jsn,

if (state->type == JSONSL_T_HKEY) {
ctx->key = ctx->buf + state->pos_begin + 1;
ctx->nkey = state->pos_cur - state->pos_begin - 1;
ctx->nkey = jsn->pos - state->pos_begin - 1;
return;
}

if (ctx->match_status == JSONSL_MATCH_COMPLETE) {
ctx->match_end = state->pos_cur;
ctx->match_end = jsn->pos;
jsonsl_stop(jsn);
}
}
Expand Down

0 comments on commit 684b60f

Please sign in to comment.