use space consistently in function and function-like macro invocations
commit8528d00c7034cb11d54437c7df043d998cc7d06e
authorLaszlo Ersek <lersek@redhat.com>
Fri, 3 Mar 2023 07:51:40 +0000 (3 08:51 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Sat, 4 Mar 2023 05:06:02 +0000 (4 06:06 +0100)
tree7cc9b262508cbb4abb7b0d8c897837bd00b046d4
parent79f5422f8bb1d8afedf62ac55a5bb0d31f869cb3
use space consistently in function and function-like macro invocations

(This is a reimplementation from scratch of libnbd commit b5101fbc59cb,
"use space consistently in function and function-like macro invocations",
2023-02-22.)

We intend to place a space character between the function designator and
the opening parenthesis in a function call. We've been executing on that
mostly consistently; fix the few exceptions now.

The same convention should be applied to the invocations of function-like
macros, and to instances of "__attribute__ ((attr))". (The latter is
exemplified, although not consistently, by the GCC manual.) Implement
this, by inserting the necessary spaces.

Furthermore, the C standard calls "defined" -- as in "#if defined
identifier" and (equivalently) "#if defined (identifier)" -- a unary
preprocessing operator. We can spell the parenthesized form as

  defined (identifier)

rather than

  defined(identifier)

so choose the former.

While at it, touch up the following space-related warts:

- The parameter / argument lists of the STUB() and OPTIONAL_STUB() macros,
  used in VDDK code, lack spaces after the commas; supply them.

- There is a single backslash in the definition of each of the
  ACQUIRE_LOCK_FOR_CURRENT_SCOPE(), ACQUIRE_WRLOCK_FOR_CURRENT_SCOPE(),
  ACQUIRE_RDLOCK_FOR_CURRENT_SCOPE(), and GET_HANDLE_FOR_CURRENT_SCOPE()
  macros. Each backslash is preceded by many spaces, even though there are
  no multiple backslashes that should be aligned. Squeeze the space
  characters.

I collected the locations possibly missing spaces with:

  git grep -EHn '\<[a-zA-Z0-9_]+\(' -- '*.c' '*.h'

and then manually updated each as necessary (this time using negative
look-behind regexes in xnedit, for excluding "#define MACRO(...)"
matches).

I didn't change occurrences in comments (no comment seemed to indicate
copying and pasting an expression into new code).

"git show -w" outputs nothing for this patch.

The test suite passes.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20230303075145.177338-5-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Eric Blake <eblake@redhat.com>
161 files changed:
common/allocators/allocator-internal.h
common/allocators/allocator.c
common/allocators/allocator.h
common/allocators/malloc.c
common/allocators/sparse.c
common/allocators/zstd.c
common/bitmap/bitmap.c
common/bitmap/bitmap.h
common/gpt/efi-crc32.h
common/include/array-size.h
common/include/byte-swapping.h
common/include/checked-overflow.h
common/include/compiler-macros.h
common/include/iszero.h
common/include/minmax.h
common/include/nextnonzero.h
common/include/random.h
common/include/test-array-size.c
common/include/test-random.c
common/protocol/nbd-protocol.h
common/regions/regions.c
common/regions/regions.h
common/replacements/open_memstream.c
common/replacements/strndup.c
common/replacements/strndup.h
common/utils/cleanup.h
common/utils/const-string-vector.h
common/utils/exit-with-parent.c
common/utils/nbdkit-string.h
common/utils/string-vector.h
common/utils/test-vector.c
common/utils/utils.c
common/utils/utils.h
common/utils/vector.h
filters/blocksize-policy/policy.c
filters/blocksize/blocksize.c
filters/cache/blk.h
filters/cache/cache.c
filters/cache/reclaim.c
filters/checkwrite/checkwrite.c
filters/cow/blk.h
filters/cow/cow.c
filters/ddrescue/ddrescue.c
filters/delay/delay.c
filters/error/error.c
filters/exitlast/exitlast.c
filters/exitwhen/exitwhen.c
filters/exportname/exportname.c
filters/ext2/ext2.c
filters/ext2/io.h
filters/extentlist/extentlist.c
filters/fua/fua.c
filters/gzip/gzip.c
filters/ip/ip.c
filters/limit/limit.c
filters/log/log.c
filters/log/log.h
filters/luks/luks-encryption.c
filters/luks/luks.c
filters/multi-conn/multi-conn.c
filters/nocache/nocache.c
filters/noextents/noextents.c
filters/nofilter/nofilter.c
filters/noparallel/noparallel.c
filters/nozero/nozero.c
filters/offset/offset.c
filters/partition/partition-gpt.c
filters/partition/partition.c
filters/pause/pause.c
filters/protect/protect.c
filters/rate/rate.c
filters/readahead/readahead.c
filters/readahead/readahead.h
filters/retry-request/retry-request.c
filters/retry/retry.c
filters/scan/scan.c
filters/scan/scan.h
filters/swab/swab.c
filters/tar/tar.c
filters/tls-fallback/tls-fallback.c
filters/truncate/truncate.c
filters/xz/blkcache.h
filters/xz/xz.c
include/nbdkit-common.h
plugins/blkio/blkio.c
plugins/cc/cc.c
plugins/cdi/cdi.c
plugins/curl/curl.c
plugins/curl/curldefs.h
plugins/curl/pool.c
plugins/data/data.c
plugins/data/format.c
plugins/eval/eval.c
plugins/example1/example1.c
plugins/example2/example2.c
plugins/example2/winexample2.c
plugins/example3/example3.c
plugins/file/file.c
plugins/file/winfile.c
plugins/floppy/floppy.c
plugins/floppy/virtual-floppy.c
plugins/floppy/virtual-floppy.h
plugins/full/full.c
plugins/guestfs/guestfs-plugin.c
plugins/info/info.c
plugins/iso/iso.c
plugins/libvirt/libvirt-plugin.c
plugins/linuxdisk/linuxdisk.c
plugins/linuxdisk/virtual-disk.h
plugins/lua/lua.c
plugins/memory/memory.c
plugins/null/null.c
plugins/ocaml/callbacks.h
plugins/ocaml/plugin.c
plugins/ocaml/plugin.h
plugins/ondemand/ondemand.c
plugins/partitioning/partitioning.c
plugins/partitioning/virtual-disk.h
plugins/pattern/pattern.c
plugins/perl/perl.c
plugins/python/modfunctions.c
plugins/python/plugin.h
plugins/random/random.c
plugins/ruby/ruby.c
plugins/sh/call.h
plugins/sh/sh.c
plugins/sparse-random/sparse-random.c
plugins/split/split.c
plugins/ssh/ssh.c
plugins/tcl/tcl.c
plugins/tmpdisk/tmpdisk.c
plugins/vddk/stats.c
plugins/vddk/vddk.c
plugins/vddk/vddk.h
plugins/zero/zero.c
server/connections.c
server/crypto.c
server/exports.c
server/extents.c
server/internal.h
server/main.c
server/protocol-handshake-newstyle.c
server/public.c
server/socket-activation.c
server/sockets.c
server/test-public.c
server/usergroup.c
tests/cc-shebang.c
tests/dummy-vddk.c
tests/test-ansi-c-plugin.c
tests/test-disconnect-plugin.c
tests/test-flush-plugin.c
tests/test-layers-filter.c
tests/test-layers-plugin.c
tests/test-layers.c
tests/test-read-password-plugin.c
tests/test-shutdown-plugin.c
tests/test-stdio-plugin.c
tests/test.h
tests/web-server.h
wrapper.c