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
+15 -6
View File
@@ -27,9 +27,16 @@ static struct object_data Object_List[MAX_ACCUMULATORS];
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
PROP_EVENT_STATE, PROP_OUT_OF_SERVICE, PROP_SCALE, PROP_UNITS,
PROP_MAX_PRES_VALUE, -1 };
PROP_OBJECT_NAME,
PROP_OBJECT_TYPE,
PROP_PRESENT_VALUE,
PROP_STATUS_FLAGS,
PROP_EVENT_STATE,
PROP_OUT_OF_SERVICE,
PROP_SCALE,
PROP_UNITS,
PROP_MAX_PRES_VALUE,
-1 };
static const int Properties_Optional[] = { PROP_DESCRIPTION, -1 };
@@ -138,8 +145,9 @@ bool Accumulator_Object_Name(
bool status = false;
if (object_instance < MAX_ACCUMULATORS) {
snprintf(text, sizeof(text),
"ACCUMULATOR-%lu", (unsigned long)object_instance);
snprintf(
text, sizeof(text), "ACCUMULATOR-%lu",
(unsigned long)object_instance);
status = characterstring_init_ansi(object_name, text);
}
@@ -314,7 +322,8 @@ int Accumulator_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
break;
case PROP_SCALE:
/* context tagged choice: [0]=REAL, [1]=INTEGER */
apdu_len = encode_context_signed(&apdu[apdu_len], 1,
apdu_len = encode_context_signed(
&apdu[apdu_len], 1,
Accumulator_Scale_Integer(rpdata->object_instance));
break;
case PROP_MAX_PRES_VALUE: