On Tue, Apr 18, 2023 at 07:26:21PM +0200, Laszlo Ersek wrote:
(The changes in this patch are simple, but likely more controversial than the rest.)
The following four components don't play nice together:
- Needlessly spelling out "extern" for function declarations in header files. (C99 6.2.2p5: "If the declaration of an identifier for a function has no storage-class specifier, its linkage is determined exactly as if it were declared with the storage-class specifier extern [...]".)
Well I didn't know that ...
- Long return type names.
- Very long function names, such as "nbd_internal" + ("crypto_create_session" or "state_group_parent").
- Not placing function names seen in declarators (as opposed to those seen in definitions) at column #0, lest we confuse utilities that scan for "tags".
Shorten lines by breaking the function names to new lines as well, but indent them to column #2.
As long as the first column doesn't have the function name, so I can still 'git grep ^function' to find the definition, it's fine. And that seems to be the case here. Rich.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2172516 Signed-off-by: Laszlo Ersek <lersek@redhat.com> --- lib/internal.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/internal.h b/lib/internal.h index 2de8e4e5e043..b155681d057f 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -407,7 +407,9 @@ extern int nbd_internal_wait_until_connected (struct nbd_handle *h) LIBNBD_ATTRIBUTE_NONNULL (1);
/* crypto.c */ -extern struct socket *nbd_internal_crypto_create_session (struct nbd_handle *, struct socket *oldsock) +extern struct socket * + nbd_internal_crypto_create_session (struct nbd_handle *, + struct socket *oldsock) LIBNBD_ATTRIBUTE_NONNULL (1, 2); extern bool nbd_internal_crypto_is_reading (struct nbd_handle *) LIBNBD_ATTRIBUTE_NONNULL (1); @@ -504,7 +506,8 @@ extern int nbd_internal_run (struct nbd_handle *h, enum external_event ev) LIBNBD_ATTRIBUTE_NONNULL (1); extern const char *nbd_internal_state_short_string (enum state state); extern enum state_group nbd_internal_state_group (enum state state); -extern enum state_group nbd_internal_state_group_parent (enum state_group group); +extern enum state_group + nbd_internal_state_group_parent (enum state_group group); extern int nbd_internal_aio_get_direction (enum state state);
#define set_next_state(h,next_state) ((h)->state) = (next_state)
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v