diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-05-31 14:42:03 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-06-02 15:08:25 -0600 |
commit | 559627b00b74e11e394589bfcc8864b0f22d7e1b (patch) | |
tree | 45d54aca9fd5a4bb67ad55e50b71eaa6713894c0 /lib9p/core_include | |
parent | f428acdaf8c8851323391a949f0a9cbcf521adda (diff) |
libmisc: obj.h: Use LM_DEFAPPEND() to implement magic LO_BOX()
Diffstat (limited to 'lib9p/core_include')
-rw-r--r-- | lib9p/core_include/lib9p/core.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib9p/core_include/lib9p/core.h b/lib9p/core_include/lib9p/core.h index afefa2b..1fb71f1 100644 --- a/lib9p/core_include/lib9p/core.h +++ b/lib9p/core_include/lib9p/core.h @@ -66,19 +66,19 @@ bool lib9p_ctx_has_error(struct lib9p_ctx *ctx); #endif /** Write a <libmisc/fmt.h>-style error into ctx, return -1. */ -#define lib9p_error(ctx, linux_errno, ...) ({ \ - if (!lib9p_ctx_has_error(ctx)) { \ - _lib9p_set_err_num(ctx, linux_errno); \ - struct fmt_buf _w = { \ - .dat = (ctx)->err_msg, \ - .cap = sizeof((ctx)->err_msg), \ - }; \ - lo_interface fmt_dest w = lo_box_fmt_buf_as_fmt_dest(&_w); \ - fmt_print(w, __VA_ARGS__); \ - if (_w.len < _w.cap) \ - memset(_w.dat + _w.len, 0, _w.cap - _w.len); \ - } \ - -1; \ +#define lib9p_error(ctx, linux_errno, ...) ({ \ + if (!lib9p_ctx_has_error(ctx)) { \ + _lib9p_set_err_num(ctx, linux_errno); \ + struct fmt_buf _w = { \ + .dat = (ctx)->err_msg, \ + .cap = sizeof((ctx)->err_msg), \ + }; \ + lo_interface fmt_dest w = LO_BOX(fmt_dest, &_w); \ + fmt_print(w, __VA_ARGS__); \ + if (_w.len < _w.cap) \ + memset(_w.dat + _w.len, 0, _w.cap - _w.len); \ + } \ + -1; \ }) /* misc utilities *************************************************************/ |