]> git.ipfire.org Git - thirdparty/systemd.git/commit
Use c99 static array size declarations in exported functions too 11328/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Jan 2019 11:37:10 +0000 (12:37 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Jan 2019 11:37:25 +0000 (12:37 +0100)
commit4199f6896aee4394bddfb85e45eabe34d60038cb
tree5c8b1f91631215cb4d83ddbdbe0f72f7437fb975
parent3042bbebddb819371aa2ee0811a1f9d3d38f7b94
Use c99 static array size declarations in exported functions too

It seems quite useful to provide this additional information in public exported
functions.

This is a c99 feature, not supported in C++. Without the check in _sd-common.h:
FAILED: test-bus-vtable-cc@exe/src_libsystemd_sd-bus_test-bus-vtable-cc.cc.o
...
In file included from ../src/libsystemd/sd-bus/test-bus-vtable-cc.cc:9:
In file included from ../src/systemd/sd-bus-vtable.h:26:
In file included from ../src/systemd/sd-bus.h:26:
../src/systemd/sd-id128.h:38:47: error: static array size is a C99 feature, not permitted in C++
char *sd_id128_to_string(sd_id128_t id, char s[static SD_ID128_STRING_MAX]);
                                              ^

In .c files, I opted to use the define for consistency, even though we don't support
compilation with a C++ compiler, so the unconditional keyword would work too.
src/libsystemd-network/lldp-neighbor.c
src/libsystemd/sd-id128/sd-id128.c
src/systemd/_sd-common.h
src/systemd/sd-id128.h
src/systemd/sd-lldp.h