Mercurial > hg > th-libs
changeset 519:e1b15fb56ddf
Change return value of th_io_error() and th_io_error_v() to int, and return the error code.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 26 Dec 2019 13:07:09 +0200 |
parents | 4913e4230e5c |
children | 8b36f2566cf9 |
files | th_ioctx.c th_ioctx.h |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/th_ioctx.c Thu Dec 26 13:05:40 2019 +0200 +++ b/th_ioctx.c Thu Dec 26 13:07:09 2019 +0200 @@ -108,7 +108,7 @@ } -void th_io_error_v(th_ioctx *ctx, const int err, const char *fmt, va_list ap) +int th_io_error_v(th_ioctx *ctx, const int err, const char *fmt, va_list ap) { char *msg = th_strdup_vprintf(fmt, ap); @@ -118,15 +118,17 @@ THERR("'%s' #%" PRIu_SIZE_T ": %s\n", ctx->filename, ctx->line, msg); th_free(msg); + return err; } -void th_io_error(th_ioctx *ctx, const int err, const char *fmt, ...) +int th_io_error(th_ioctx *ctx, const int err, const char *fmt, ...) { va_list ap; va_start(ap, fmt); th_io_error_v(ctx, err, fmt, ap); va_end(ap); + return err; }
--- a/th_ioctx.h Thu Dec 26 13:05:40 2019 +0200 +++ b/th_ioctx.h Thu Dec 26 13:07:09 2019 +0200 @@ -87,9 +87,9 @@ void (*error)(th_ioctx *, const int, const char *msg), void (*msg)(th_ioctx *, const int, const char *msg)); -void th_io_error_v(th_ioctx *ctx, const int err, const char *fmt, va_list ap); +int th_io_error_v(th_ioctx *ctx, const int err, const char *fmt, va_list ap); void th_io_msg_v(th_ioctx *ctx, const int level, const char *fmt, va_list ap); -void th_io_error(th_ioctx *ctx, const int err, const char *fmt, ...); +int th_io_error(th_ioctx *ctx, const int err, const char *fmt, ...); void th_io_msg(th_ioctx *ctx, const int level, const char *fmt, ...);