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-08 03:16:03 -0600 |
commit | d2e229a8961ace8907645f4068a9d9414d5a36ae (patch) | |
tree | fe521b2acc1643935f1a56a3497d3eeb27394f33 /libmisc | |
parent | e3fd00bb4e2b7b4cabfb416e59fdf83e331a9374 (diff) |
libmisc: obj.h: Use LM_DEFAPPEND() to have lo_box_*_as_*() be macros
Diffstat (limited to 'libmisc')
-rw-r--r-- | libmisc/include/libmisc/obj.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libmisc/include/libmisc/obj.h b/libmisc/include/libmisc/obj.h index 04438f6..993bb1a 100644 --- a/libmisc/include/libmisc/obj.h +++ b/libmisc/include/libmisc/obj.h @@ -100,7 +100,7 @@ * interface with functions named `{impl_name}_{method_name}`. * * This will also define a `lo_box_{impl_name}_as_{iface_name}(obj)` - * function. + * const-expr macro. * * You must also call the LO_IMPLEMENTATION_C in a single .c file. */ @@ -109,13 +109,12 @@ extern const struct _lo_##_ARG_iface_name##_vtable \ _lo_##_ARG_impl_name##_##_ARG_iface_name##_vtable; \ /* Boxing. */ \ - LM_ALWAYS_INLINE static lo_interface _ARG_iface_name \ - lo_box_##_ARG_impl_name##_as_##_ARG_iface_name(_ARG_impl_type *self) { \ - return (lo_interface _ARG_iface_name){ \ - .self = self, \ + LM_DEFAPPEND(lo_box_##_ARG_impl_name##_as_##_ARG_iface_name(_ARG_self), ( \ + (lo_interface _ARG_iface_name){ \ + .self = (_ARG_self), \ .vtable = &_lo_##_ARG_impl_name##_##_ARG_iface_name##_vtable, \ - }; \ - } \ + } \ + )); \ LM_FORCE_SEMICOLON /** |