diff options
Diffstat (limited to 'fmt.c')
-rw-r--r-- | fmt.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -24,6 +24,7 @@ */ #include <assert.h> +#include <errno.h> #include <limits.h> #include <stdbool.h> #include <stdarg.h> @@ -32,7 +33,6 @@ #include <stdio.h> #include <string.h> -#include "error.h" #include "fmt.h" #include "macros.h" @@ -404,12 +404,12 @@ fmt_sprintf_state_consume(struct fmt_sprintf_state *state) c = fmt_consume(&state->format); if (c == '\0') { - return ERROR_NORES; + return ENOENT; } if (c != '%') { fmt_sprintf_state_produce_raw_char(state, c); - return ERROR_AGAIN; + return EAGAIN; } fmt_sprintf_state_consume_flags(state); @@ -788,7 +788,7 @@ fmt_vsnprintf(char *str, size_t size, const char *format, va_list ap) for (;;) { error = fmt_sprintf_state_consume(&state); - if (error == ERROR_AGAIN) { + if (error == EAGAIN) { continue; } else if (error) { break; @@ -1069,7 +1069,7 @@ fmt_sscanf_state_discard_char(struct fmt_sscanf_state *state, char c) state->nr_convs = EOF; } - return ERROR_FORMAT; + return EINVAL; } return 0; @@ -1086,7 +1086,7 @@ fmt_sscanf_state_consume(struct fmt_sscanf_state *state) c = fmt_consume(&state->format); if (c == '\0') { - return ERROR_NORES; + return ENOENT; } if (c != '%') { @@ -1096,7 +1096,7 @@ fmt_sscanf_state_consume(struct fmt_sscanf_state *state) return error; } - return ERROR_AGAIN; + return EAGAIN; } fmt_sscanf_state_consume_flags(state); @@ -1188,7 +1188,7 @@ fmt_sscanf_state_produce_int(struct fmt_sscanf_state *state) if (i == 0) { if (c == '\0') { fmt_sscanf_state_report_error(state); - return ERROR_FORMAT; + return EINVAL; } buf[0] = '0'; @@ -1382,7 +1382,7 @@ fmt_sscanf_state_produce_str(struct fmt_sscanf_state *state) if (state->str == orig) { fmt_sscanf_state_report_error(state); - return ERROR_FORMAT; + return EINVAL; } if (dest != NULL) { @@ -1417,7 +1417,7 @@ fmt_sscanf_state_produce(struct fmt_sscanf_state *state) return fmt_sscanf_state_discard_char(state, '%'); default: fmt_sscanf_state_report_error(state); - return ERROR_FORMAT; + return EINVAL; } } @@ -1445,7 +1445,7 @@ fmt_vsscanf(const char *str, const char *format, va_list ap) for (;;) { error = fmt_sscanf_state_consume(&state); - if (error == ERROR_AGAIN) { + if (error == EAGAIN) { continue; } else if (error) { break; |