diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f41bcd0..9c7f2dc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,10 @@ +# Oct. 17, 2014; Daniel Holden +- Reverted state to use long type + +# Oct. 16, 2014; Daniel Holden +- Removed comments describing changes +- Fixed warnings reported by gcc in test suite under the new compilation flags + # Oct. 14, 2014; Dalton Woodard - Fixed all compilation warnings in `mpc.h` and `mpc.c`; both now compile successfully on OS X under clang-600.0.51 and gcc 4.9.1 with the following flags: diff --git a/mpc.c b/mpc.c index d31b523..f9cced1 100644 --- a/mpc.c +++ b/mpc.c @@ -6,9 +6,9 @@ static mpc_state_t mpc_state_invalid(void) { mpc_state_t s; - s.pos = SIZE_MAX; - s.row = SIZE_MAX; - s.col = SIZE_MAX; + s.pos = -1; + s.row = -1; + s.col = -1; return s; } @@ -465,7 +465,7 @@ static void mpc_input_rewind(mpc_input_t *i) { } static int mpc_input_buffer_in_range(mpc_input_t *i) { - return i->state.pos < (strlen(i->buffer) + i->marks[0].pos); + return i->state.pos < (long)(strlen(i->buffer) + i->marks[0].pos); } static char mpc_input_buffer_get(mpc_input_t *i) { @@ -473,7 +473,7 @@ static char mpc_input_buffer_get(mpc_input_t *i) { } static int mpc_input_terminated(mpc_input_t *i) { - if (i->type == MPC_INPUT_STRING && i->state.pos == strlen(i->string)) { return 1; } + if (i->type == MPC_INPUT_STRING && i->state.pos == (long)strlen(i->string)) { return 1; } if (i->type == MPC_INPUT_FILE && feof(i->file)) { return 1; } if (i->type == MPC_INPUT_PIPE && feof(i->file)) { return 1; } return 0; diff --git a/mpc.h b/mpc.h index 9f67410..9ea77dd 100644 --- a/mpc.h +++ b/mpc.h @@ -21,14 +21,10 @@ ** State Type */ -/* -** changed to unsigned values for indexing in state, -** invalid is now signified by SIZE_MAX. -*/ typedef struct { - size_t pos; - size_t row; - size_t col; + long pos; + long row; + long col; } mpc_state_t; /*