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
+10 -6
View File
@@ -46,7 +46,8 @@ static char *Communication_Password = NULL;
static bool Error_Detected = false;
static void MyErrorHandler(BACNET_ADDRESS *src,
static void MyErrorHandler(
BACNET_ADDRESS *src,
uint8_t invoke_id,
BACNET_ERROR_CLASS error_class,
BACNET_ERROR_CODE error_code)
@@ -54,7 +55,8 @@ static void MyErrorHandler(BACNET_ADDRESS *src,
/* FIXME: verify src and invoke id */
(void)src;
(void)invoke_id;
printf("BACnet Error: %s: %s\n", bactext_error_class_name(error_class),
printf(
"BACnet Error: %s: %s\n", bactext_error_class_name(error_class),
bactext_error_code_name(error_code));
Error_Detected = true;
}
@@ -70,8 +72,8 @@ static void MyAbortHandler(
Error_Detected = true;
}
static void MyRejectHandler(
BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
static void
MyRejectHandler(BACNET_ADDRESS *src, uint8_t invoke_id, uint8_t reject_reason)
{
/* FIXME: verify src and invoke id */
(void)src;
@@ -103,7 +105,8 @@ static void Init_Service_Handlers(void)
apdu_set_confirmed_handler(
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property);
/* handle communication so we can shutup when asked */
apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
apdu_set_confirmed_handler(
SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
handler_device_communication_control);
/* handle the ack coming back */
apdu_set_confirmed_simple_ack_handler(
@@ -190,7 +193,8 @@ int main(int argc, char *argv[])
Communication_Password = argv[4];
}
if (Target_Device_Object_Instance > BACNET_MAX_INSTANCE) {
fprintf(stderr, "device-instance=%u - not greater than %u\n",
fprintf(
stderr, "device-instance=%u - not greater than %u\n",
Target_Device_Object_Instance, BACNET_MAX_INSTANCE);
return 1;
}