On 2/11/20 11:15 AM, Richard W.M. Jones wrote:
 Since we're going to be calling this function a lot, add a short
alias
 for it.
 ---
   server/internal.h | 1 +
   server/public.c   | 6 +++---
   2 files changed, 4 insertions(+), 3 deletions(-)
 
 diff --git a/server/internal.h b/server/internal.h
 index a1fa7309..1e7b4cf0 100644
 --- a/server/internal.h
 +++ b/server/internal.h
 @@ -493,6 +493,7 @@ extern int threadlocal_get_error (void);
   extern void *threadlocal_buffer (size_t size);
   extern void threadlocal_set_conn (struct connection *conn);
   extern struct connection *threadlocal_get_conn (void);
 +#define GET_CONN (threadlocal_get_conn ()) 
Do we want any checking, such as whether this is non-NULL?
For example, patch 3 has:
-typedef void (*connection_close_function) (struct connection *)
    __attribute__((__nonnull__ (1)));
+typedef void (*connection_close_function) (void);
which loses the compile-time checking that we have a non-NULL connection 
parameter; so replacing a parameter passed through a nonnull attribute 
with a macro that guarantees a nonnull result might be in our favor, 
where we can leave explicit calls to threadlocal_get_conn() rather than 
macro usage for the few callers that expect to handle the corner cases 
where a threadlocal connection might not yet be set.
-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  
qemu.org | 
libvirt.org