Mercurial > hg > th-libs
changeset 461:04320ca79407
Actually, use a inline function for ioctx atime updates.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 17 Feb 2018 23:42:49 +0200 |
parents | 0a1a65503e0b |
children | a90fe2c4c636 |
files | th_ioctx.c |
diffstat | 1 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/th_ioctx.c Sat Feb 17 23:41:11 2018 +0200 +++ b/th_ioctx.c Sat Feb 17 23:42:49 2018 +0200 @@ -11,7 +11,10 @@ #include <stdio.h> -#define TH_UPDATE_ATIME do { ctx->atime = time(NULL); } while (0) +static void th_io_update_atime(th_ioctx *ctx) +{ + ctx->atime = time(NULL); +} th_ioctx *th_io_new(const th_ioctx_ops *fops, const char *filename) @@ -153,63 +156,63 @@ int thferror(th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->ferror(ctx); } int thfseek(th_ioctx *ctx, const off_t offset, int whence) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->fseek(ctx, offset, whence); } off_t thfsize(th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->fsize(ctx); } off_t thftell(th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->ftell(ctx); } BOOL thfeof(th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->feof(ctx); } int thfgetc(th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->fgetc(ctx); } int thfputc(int v, th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->fputc(v, ctx); } size_t thfread(void *ptr, size_t size, size_t nmemb, th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->fread(ptr, size, nmemb, ctx); } size_t thfwrite(const void *ptr, size_t size, size_t nmemb, th_ioctx *ctx) { - TH_UPDATE_ATIME; + th_io_update_atime(ctx); return ctx->fops->fwrite(ptr, size, nmemb, ctx); }