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:
@@ -15,7 +15,8 @@
|
||||
|
||||
static struct uci_ptr ptr;
|
||||
|
||||
static __inline__ int ucix_get_ptr(struct uci_context *ctx,
|
||||
static __inline__ int ucix_get_ptr(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *s,
|
||||
const char *o,
|
||||
@@ -81,8 +82,9 @@ const char *ucix_get_option(
|
||||
if (ucix_get_ptr(ctx, p, s, o, NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
if (!(ptr.flags & UCI_LOOKUP_COMPLETE))
|
||||
if (!(ptr.flags & UCI_LOOKUP_COMPLETE)) {
|
||||
return NULL;
|
||||
}
|
||||
e = ptr.last;
|
||||
switch (e->type) {
|
||||
case UCI_TYPE_SECTION:
|
||||
@@ -105,7 +107,8 @@ const char *ucix_get_option(
|
||||
return value;
|
||||
}
|
||||
|
||||
int ucix_get_option_int(struct uci_context *ctx,
|
||||
int ucix_get_option_int(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *s,
|
||||
const char *o,
|
||||
@@ -129,7 +132,8 @@ void ucix_add_section(
|
||||
uci_set(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_add_option(struct uci_context *ctx,
|
||||
void ucix_add_option(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *s,
|
||||
const char *o,
|
||||
@@ -165,7 +169,8 @@ void ucix_revert(
|
||||
}
|
||||
}
|
||||
|
||||
void ucix_for_each_section_type(struct uci_context *ctx,
|
||||
void ucix_for_each_section_type(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *t,
|
||||
void (*cb)(const char *, void *),
|
||||
@@ -175,8 +180,9 @@ void ucix_for_each_section_type(struct uci_context *ctx,
|
||||
if (ucix_get_ptr(ctx, p, NULL, NULL, NULL)) {
|
||||
return;
|
||||
}
|
||||
uci_foreach_element(&ptr.p->sections,
|
||||
e) if (!strcmp(t, uci_to_section(e)->type)) cb(e->name, priv);
|
||||
uci_foreach_element(
|
||||
&ptr.p->sections, e) if (!strcmp(t, uci_to_section(e)->type))
|
||||
cb(e->name, priv);
|
||||
}
|
||||
|
||||
int ucix_commit(struct uci_context *ctx, const char *p)
|
||||
|
||||
@@ -11,27 +11,18 @@
|
||||
#include "bacnet/bacdef.h"
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
struct uci_context *ucix_init(
|
||||
const char *config_file);
|
||||
struct uci_context *ucix_init(const char *config_file);
|
||||
BACNET_STACK_EXPORT
|
||||
struct uci_context *ucix_init_path(
|
||||
const char *path,
|
||||
const char *config_file);
|
||||
struct uci_context *ucix_init_path(const char *path, const char *config_file);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_cleanup(
|
||||
struct uci_context *ctx);
|
||||
void ucix_cleanup(struct uci_context *ctx);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_save(
|
||||
struct uci_context *ctx);
|
||||
void ucix_save(struct uci_context *ctx);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_save_state(
|
||||
struct uci_context *ctx);
|
||||
void ucix_save_state(struct uci_context *ctx);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *ucix_get_option(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *s,
|
||||
const char *o);
|
||||
struct uci_context *ctx, const char *p, const char *s, const char *o);
|
||||
BACNET_STACK_EXPORT
|
||||
int ucix_get_option_int(
|
||||
struct uci_context *ctx,
|
||||
@@ -41,10 +32,7 @@ int ucix_get_option_int(
|
||||
int def);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_add_section(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *s,
|
||||
const char *t);
|
||||
struct uci_context *ctx, const char *p, const char *s, const char *t);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_add_option(
|
||||
struct uci_context *ctx,
|
||||
@@ -60,23 +48,16 @@ void ucix_add_option_int(
|
||||
const char *o,
|
||||
int t);
|
||||
BACNET_STACK_EXPORT
|
||||
int ucix_commit(
|
||||
struct uci_context *ctx,
|
||||
const char *p);
|
||||
int ucix_commit(struct uci_context *ctx, const char *p);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_revert(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *s,
|
||||
const char *o);
|
||||
struct uci_context *ctx, const char *p, const char *s, const char *o);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_del(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *s,
|
||||
const char *o);
|
||||
struct uci_context *ctx, const char *p, const char *s, const char *o);
|
||||
BACNET_STACK_EXPORT
|
||||
void ucix_for_each_section_type(struct uci_context *ctx,
|
||||
void ucix_for_each_section_type(
|
||||
struct uci_context *ctx,
|
||||
const char *p,
|
||||
const char *t,
|
||||
void (*cb)(const char *, void *),
|
||||
|
||||
Reference in New Issue
Block a user