X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=linenoise.c;fp=linenoise.c;h=ec1be46b78d98abf2d99fbd31cbd9b5849d3128f;hb=b01b57f3c5caf03f405e386fae809948a5a7f5c6;hp=c5520754950a377c612e6405436f31c61bbe8cf3;hpb=d1a245f4a75747a1c4a1c08385817cb637e1c7af;p=linenoise.git diff --git a/linenoise.c b/linenoise.c index c552075..ec1be46 100644 --- a/linenoise.c +++ b/linenoise.c @@ -227,15 +227,17 @@ void linenoiseHistoryFree(void) { } } +typedef enum { + EP_START, /* looking for ESC */ + EP_ESC, /* looking for [ */ + EP_DIGITS, /* parsing digits */ + EP_PROPS, /* parsing digits or semicolons */ + EP_END, /* ok */ + EP_ERROR, /* error */ +} ep_state_t; + struct esc_parser { - enum { - EP_START, /* looking for ESC */ - EP_ESC, /* looking for [ */ - EP_DIGITS, /* parsing digits */ - EP_PROPS, /* parsing digits or semicolons */ - EP_END, /* ok */ - EP_ERROR, /* error */ - } state; + ep_state_t state; int props[5]; /* properties are stored here */ int maxprops; /* size of the props[] array */ int numprops; /* number of properties found */ @@ -342,7 +344,7 @@ static void DRL_STR(const char *str) } } #else -#define DRL(ARGS...) +#define DRL(...) #define DRL_CHAR(ch) #define DRL_STR(str) #endif @@ -1016,6 +1018,7 @@ static void refreshEnd(struct current *current) static void refreshStartChars(struct current *current) { + (void)current; } static void refreshNewline(struct current *current) @@ -1026,6 +1029,7 @@ static void refreshNewline(struct current *current) static void refreshEndChars(struct current *current) { + (void)current; } #endif @@ -1463,8 +1467,8 @@ static int reverseIncrementalSearch(struct current *current) c = fd_read(current); if (c == ctrl('H') || c == CHAR_DELETE) { if (rchars) { - int p = utf8_index(rbuf, --rchars); - rbuf[p] = 0; + int p_ind = utf8_index(rbuf, --rchars); + rbuf[p_ind] = 0; rlen = strlen(rbuf); } continue;