From 684b60f9af68b8c397422e74d0c2dd206de16a2c Mon Sep 17 00:00:00 2001 From: Mark Nunberg Date: Fri, 3 Nov 2017 08:33:51 -0400 Subject: [PATCH] Remove pos_cur from examples and tests --- examples/glib-datatypes.c | 2 +- tests/jpr_test.c | 4 ++-- tests/json_test.c | 2 +- tests/match_test.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/glib-datatypes.c b/examples/glib-datatypes.c index 57813f0..d511178 100644 --- a/examples/glib-datatypes.c +++ b/examples/glib-datatypes.c @@ -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; } diff --git a/tests/jpr_test.c b/tests/jpr_test.c index 226759b..782b4d4 100644 --- a/tests/jpr_test.c +++ b/tests/jpr_test.c @@ -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"); diff --git a/tests/json_test.c b/tests/json_test.c index d9e7d1f..7fcd6f8 100644 --- a/tests/json_test.c +++ b/tests/json_test.c @@ -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; } */ } diff --git a/tests/match_test.c b/tests/match_test.c index 7af7b96..df6b565 100644 --- a/tests/match_test.c +++ b/tests/match_test.c @@ -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); } }