Mercurial > hg > th-libs
changeset 217:97c1ab4719cf
Don't use macro expansion in the th_ctx.h header file for generating the
th{read,write}_{ne,be,le}{16,32,64}() function prototypes. Instead
pre-expand them out, makes the error messages a bit more sane for GCC.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 14 Feb 2016 05:12:44 +0200 |
parents | 4fee16cb28c1 |
children | e20fdeee6bdf |
files | th_ioctx.h |
diffstat | 1 files changed, 18 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/th_ioctx.h Fri Feb 12 18:19:01 2016 +0200 +++ b/th_ioctx.h Sun Feb 14 05:12:44 2016 +0200 @@ -118,20 +118,26 @@ // // Endian-handling file read/write routines // -#define TH_DEFINE_HEADER(xname, xtype) \ -BOOL thfread_ ## xname (th_ioctx *ctx, xtype *v); \ -BOOL thfwrite_ ## xname (th_ioctx *ctx, const xtype v); - -TH_DEFINE_HEADER(le16, uint16_t) -TH_DEFINE_HEADER(le32, uint32_t) +BOOL thfwrite_ne16(th_ioctx *ctx, const uint16_t v); +BOOL thfwrite_ne32(th_ioctx *ctx, const uint32_t v); +BOOL thfwrite_ne64(th_ioctx *ctx, const uint64_t v); +BOOL thfread_ne16(th_ioctx *ctx, uint16_t *v); +BOOL thfread_ne32(th_ioctx *ctx, uint32_t *v); +BOOL thfread_ne64(th_ioctx *ctx, uint64_t *v); -TH_DEFINE_HEADER(be16, uint16_t) -TH_DEFINE_HEADER(be32, uint32_t) +BOOL thfwrite_le16(th_ioctx *ctx, const uint16_t v); +BOOL thfwrite_le32(th_ioctx *ctx, const uint32_t v); +BOOL thfwrite_le64(th_ioctx *ctx, const uint64_t v); +BOOL thfread_le16(th_ioctx *ctx, uint16_t *v); +BOOL thfread_le32(th_ioctx *ctx, uint32_t *v); +BOOL thfread_le64(th_ioctx *ctx, uint64_t *v); -TH_DEFINE_HEADER(be64, uint64_t) -TH_DEFINE_HEADER(le64, uint64_t) - -#undef TH_DEFINE_HEADER +BOOL thfwrite_be16(th_ioctx *ctx, const uint16_t v); +BOOL thfwrite_be32(th_ioctx *ctx, const uint32_t v); +BOOL thfwrite_be64(th_ioctx *ctx, const uint64_t v); +BOOL thfread_be16(th_ioctx *ctx, uint16_t *v); +BOOL thfread_be32(th_ioctx *ctx, uint32_t *v); +BOOL thfread_be64(th_ioctx *ctx, uint64_t *v); #ifdef __cplusplus