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
+30 -43
View File
@@ -16,75 +16,62 @@
/* index and text pairs */
typedef const struct {
const unsigned index; /* index number that matches the text */
const char *pString; /* text pair - use NULL to end the list */
const unsigned index; /* index number that matches the text */
const char *pString; /* text pair - use NULL to end the list */
} INDTEXT_DATA;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
BACNET_STACK_EXPORT
int indtext_stricmp(const char *a, const char *b);
BACNET_STACK_EXPORT
int indtext_stricmp(const char *a, const char *b);
/* Searches for a matching string and returns the index to the string
in the parameter found_index.
If the string is not found, false is returned
If the string is found, true is returned and the found_index contains
the first index where the string was found. */
BACNET_STACK_EXPORT
bool indtext_by_string(
INDTEXT_DATA * data_list,
const char *search_name,
unsigned *found_index);
BACNET_STACK_EXPORT
bool indtext_by_string(
INDTEXT_DATA *data_list, const char *search_name, unsigned *found_index);
/* case insensitive version */
BACNET_STACK_EXPORT
bool indtext_by_istring(
INDTEXT_DATA * data_list,
const char *search_name,
unsigned *found_index);
BACNET_STACK_EXPORT
bool indtext_by_istring(
INDTEXT_DATA *data_list, const char *search_name, unsigned *found_index);
/* Searches for a matching string and returns the index to the string
or the default_index if the string is not found. */
BACNET_STACK_EXPORT
unsigned indtext_by_string_default(
INDTEXT_DATA * data_list,
const char *search_name,
unsigned default_index);
BACNET_STACK_EXPORT
unsigned indtext_by_string_default(
INDTEXT_DATA *data_list, const char *search_name, unsigned default_index);
/* case insensitive version */
BACNET_STACK_EXPORT
unsigned indtext_by_istring_default(
INDTEXT_DATA * data_list,
const char *search_name,
unsigned default_index);
BACNET_STACK_EXPORT
unsigned indtext_by_istring_default(
INDTEXT_DATA *data_list, const char *search_name, unsigned default_index);
/* for a given index, return the matching string,
or NULL if not found */
BACNET_STACK_EXPORT
const char *indtext_by_index(
INDTEXT_DATA * data_list,
unsigned index);
BACNET_STACK_EXPORT
const char *indtext_by_index(INDTEXT_DATA *data_list, unsigned index);
/* for a given index, return the matching string,
or default_name if not found */
BACNET_STACK_EXPORT
const char *indtext_by_index_default(
INDTEXT_DATA * data_list,
unsigned index,
const char *default_name);
BACNET_STACK_EXPORT
const char *indtext_by_index_default(
INDTEXT_DATA *data_list, unsigned index, const char *default_name);
/* for a given index, return the matching string,
or default_name if not found.
if the index is before the split,
the before_split_default_name is used */
BACNET_STACK_EXPORT
const char *indtext_by_index_split_default(
INDTEXT_DATA * data_list,
unsigned index,
unsigned split_index,
const char *before_split_default_name,
const char *default_name);
BACNET_STACK_EXPORT
const char *indtext_by_index_split_default(
INDTEXT_DATA *data_list,
unsigned index,
unsigned split_index,
const char *before_split_default_name,
const char *default_name);
/* returns the number of elements in the list */
BACNET_STACK_EXPORT
unsigned indtext_count(
INDTEXT_DATA * data_list);
BACNET_STACK_EXPORT
unsigned indtext_count(INDTEXT_DATA *data_list);
#ifdef __cplusplus
}