From 76688f9a0b398e14189bdad787bc21c0faf7a0bd Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 7 Sep 2021 13:38:14 +0100 Subject: [PATCH] Docs: insert missing 'inline' in a code example. In the section about our ad-hoc trait idioms, I described a code sample as containing a set of 'static inline' wrapper functions, which indeed it should have done - but I forgot to put the 'inline' keyword in the code sample itself. --- doc/udp.but | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/udp.but b/doc/udp.but index 22a8ceec..bb17219f 100644 --- a/doc/udp.but +++ b/doc/udp.but @@ -505,13 +505,13 @@ call sites. Instead, what we generally do in this code base is to write a set of \cw{static inline} wrapper functions in the same header file that defined the \cw{MyAbstraction} structure types, like this: -\c static MyAbstraction *myabs_new(const MyAbstractionVtable *vt) +\c static inline MyAbstraction *myabs_new(const MyAbstractionVtable *vt) \c { return vt->new(vt); } -\c static void myabs_free(MyAbstraction *myabs) +\c static inline void myabs_free(MyAbstraction *myabs) \c { myabs->vt->free(myabs); } -\c static void myimpl_modify(MyAbstraction *myabs, unsigned param) +\c static inline void myimpl_modify(MyAbstraction *myabs, unsigned param) \c { myabs->vt->modify(myabs, param); } -\c static unsigned myimpl_query(MyAbstraction *myabs, unsigned param) +\c static inline unsigned myimpl_query(MyAbstraction *myabs, unsigned param) \c { return myabs->vt->query(myabs, param); } And now call sites can use those reasonably clean-looking wrapper