Run clang-format and enable CI check for it (#755)

* pre-commit: Update and enable clang-format check

There is newer version from clang-format so use that. We do not yet want
18 as that is little bit too new.

* Format some thing by hand which clang-format "breaks"

Clang-format will format some things little bit off in some cases.
Format some things by hand so we get cleaner end result.

* Run clang-format with

```
pre-commit run --all-files clang-format
```

We have already in previously checked places where clang-format does not
make good format and ignored those (hopefully most of the things).

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-30 19:20:58 +03:00
committed by GitHub
parent 622a9e609e
commit f806c5829b
547 changed files with 18286 additions and 16575 deletions
+9 -7
View File
@@ -12,7 +12,7 @@
#include "bacnet/datalink/bip.h"
#include "socketWrapper.h"
#include "w5100Wrapper.h"
//#include "bacport.h"
// #include "bacport.h"
/** @file linux/bip-init.c Initializes BACnet/IP interface (Linux). */
@@ -61,7 +61,8 @@ void bip_set_interface(const char *ifname)
bip_set_addr(local_address);
if (BIP_Debug) {
fprintf(stderr, "Interface: %s\n", ifname);
fprintf(stderr, "IP Address: %d.%d.%d.%d\n", local_address[0],
fprintf(
stderr, "IP Address: %d.%d.%d.%d\n", local_address[0],
local_address[1], local_address[2], local_address[3]);
}
@@ -74,9 +75,9 @@ void bip_set_interface(const char *ifname)
bip_set_broadcast_addr(broadcast_address);
if (BIP_Debug) {
fprintf(stderr, "IP Broadcast Address: %d.%d.%d.%d\n",
broadcast_address[0], broadcast_address[1], broadcast_address[2],
broadcast_address[3]);
fprintf(
stderr, "IP Broadcast Address: %d.%d.%d.%d\n", broadcast_address[0],
broadcast_address[1], broadcast_address[2], broadcast_address[3]);
}
}
@@ -102,10 +103,11 @@ bool bip_init(char *ifname)
uint8_t sock_fd = 0;
bool isOpen = false;
if (ifname)
if (ifname) {
bip_set_interface(ifname);
else
} else {
bip_set_interface("eth0");
}
/* assumes that the driver has already been initialized */
for (sock_fd = 0; sock_fd < MAX_SOCK_NUM; sock_fd++) {