reverted state to use long type
This commit is contained in:
@@ -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
|
# 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
|
- 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:
|
and gcc 4.9.1 with the following flags:
|
||||||
|
10
mpc.c
10
mpc.c
@@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
static mpc_state_t mpc_state_invalid(void) {
|
static mpc_state_t mpc_state_invalid(void) {
|
||||||
mpc_state_t s;
|
mpc_state_t s;
|
||||||
s.pos = SIZE_MAX;
|
s.pos = -1;
|
||||||
s.row = SIZE_MAX;
|
s.row = -1;
|
||||||
s.col = SIZE_MAX;
|
s.col = -1;
|
||||||
return s;
|
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) {
|
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) {
|
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) {
|
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_FILE && feof(i->file)) { return 1; }
|
||||||
if (i->type == MPC_INPUT_PIPE && feof(i->file)) { return 1; }
|
if (i->type == MPC_INPUT_PIPE && feof(i->file)) { return 1; }
|
||||||
return 0;
|
return 0;
|
||||||
|
10
mpc.h
10
mpc.h
@@ -21,14 +21,10 @@
|
|||||||
** State Type
|
** State Type
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
** changed to unsigned values for indexing in state,
|
|
||||||
** invalid is now signified by SIZE_MAX.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t pos;
|
long pos;
|
||||||
size_t row;
|
long row;
|
||||||
size_t col;
|
long col;
|
||||||
} mpc_state_t;
|
} mpc_state_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user