input.c: namespace enum

This commit is contained in:
Peter McGoron 2021-08-09 13:44:06 -04:00
parent 6ec1d0a8ae
commit dea5819d67
1 changed files with 4 additions and 4 deletions

View File

@ -1,9 +1,9 @@
#include "input.h" #include "input.h"
enum { READ, DISCARD }; enum { LIBSCOMM_READ, LIBSCOMM_DISCARD };
void libscomm_reset(struct libscomm_input *in) { void libscomm_reset(struct libscomm_input *in) {
in->state = READ; in->state = LIBSCOMM_READ;
in->len = 0; in->len = 0;
} }
@ -40,7 +40,7 @@ enum libscomm_input_r libscomm_read(struct libscomm_input *in,
while ((c = **s)) { while ((c = **s)) {
(*s)++; (*s)++;
if (in->state == DISCARD) { if (in->state == LIBSCOMM_DISCARD) {
if (c == '\n') { if (c == '\n') {
libscomm_reset(in); libscomm_reset(in);
return LIBSCOMM_OVERFLOW; return LIBSCOMM_OVERFLOW;
@ -53,7 +53,7 @@ enum libscomm_input_r libscomm_read(struct libscomm_input *in,
default: default:
in->intbuf[in->len++] = c; in->intbuf[in->len++] = c;
if (in->len == LIBSCOMM_MAXBUF) if (in->len == LIBSCOMM_MAXBUF)
in->state = DISCARD; in->state = LIBSCOMM_DISCARD;
} }
} }
} }