From 6b01777db2a60578dd628ad52c1576fa2363be22 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 2 Mar 2023 15:51:08 +0000 Subject: [PATCH] Restyled by clang-format --- src/tools/kdb/meta-rm.c | 5 +++-- src/tools/kdb/meta-set.c | 10 ++++++---- src/tools/kdb/meta-show.c | 3 +-- src/tools/kdb/meta.c | 10 +++------- src/tools/kdb/mv.c | 2 +- src/tools/kdb/mv.h | 38 +++++++++++++++++++------------------- src/tools/kdb/set.c | 7 ++++--- src/tools/kdb/set.h | 38 +++++++++++++++++++------------------- 8 files changed, 56 insertions(+), 57 deletions(-) diff --git a/src/tools/kdb/meta-rm.c b/src/tools/kdb/meta-rm.c index 05dcdf154ca..58fb3ac023e 100644 --- a/src/tools/kdb/meta-rm.c +++ b/src/tools/kdb/meta-rm.c @@ -66,7 +66,8 @@ int execMetaRm (KeySet * options, Key * errorKey) if (keySetMeta (key, metaName, NULL) != 0 || kdbSet (handle, conf, parentKey) == -1) { ret = 1; - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (errorKey, "could not remove meta-key '%s' for '%s': %s", metaName, keyName, GET_ERR (parentKey)); + ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (errorKey, "could not remove meta-key '%s' for '%s': %s", metaName, keyName, + GET_ERR (parentKey)); } keyDel (key); @@ -76,7 +77,7 @@ int execMetaRm (KeySet * options, Key * errorKey) { printf ("\n"); } - elektraFree ((void*) keyName); + elektraFree ((void *) keyName); keyDel (parentKey); ksDel (conf); kdbClose (handle, errorKey); diff --git a/src/tools/kdb/meta-set.c b/src/tools/kdb/meta-set.c index 99505f648f8..a35c7292411 100644 --- a/src/tools/kdb/meta-set.c +++ b/src/tools/kdb/meta-set.c @@ -56,10 +56,11 @@ int execMetaSet (KeySet * options, Key * errorKey) Key * parentKey = keyNew (keyName, KEY_END); - if (keyGetNamespace (parentKey) == KEY_NS_NONE || keyGetNamespace (parentKey) == KEY_NS_CASCADING) { + if (keyGetNamespace (parentKey) == KEY_NS_NONE || keyGetNamespace (parentKey) == KEY_NS_CASCADING) + { ret = 1; ELEKTRA_SET_VALIDATION_SYNTACTIC_ERROR (errorKey, "key does not specify a namespace"); - elektraFree ((void*) keyName); + elektraFree ((void *) keyName); keyDel (parentKey); return ret; } @@ -87,7 +88,8 @@ int execMetaSet (KeySet * options, Key * errorKey) if (kdbSet (handle, conf, parentKey) == -1) { ret = 1; - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (errorKey, "could not set meta-value '%s' for '%s': %s", metaName, keyName, GET_ERR (parentKey)); + ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (errorKey, "could not set meta-value '%s' for '%s': %s", metaName, keyName, + GET_ERR (parentKey)); } keyDel (key); @@ -97,7 +99,7 @@ int execMetaSet (KeySet * options, Key * errorKey) { printf ("\n"); } - elektraFree ((void*) keyName); + elektraFree ((void *) keyName); keyDel (parentKey); ksDel (conf); kdbClose (handle, errorKey); diff --git a/src/tools/kdb/meta-show.c b/src/tools/kdb/meta-show.c index dceb056ef50..f4bbdaac5d4 100644 --- a/src/tools/kdb/meta-show.c +++ b/src/tools/kdb/meta-show.c @@ -61,8 +61,7 @@ int execMetaShow (KeySet * options, Key * errorKey) for (elektraCursor it = 0; it < ksGetSize (metaKeys); ++it) { cur = ksAtCursor (metaKeys, it); - CLI_PRINT (CLI_LOG_NONE, "%s -> %s%c", keyName (cur), BOLD(keyString (cur)), nullTerm ? '\0' : '\n'); - + CLI_PRINT (CLI_LOG_NONE, "%s -> %s%c", keyName (cur), BOLD (keyString (cur)), nullTerm ? '\0' : '\n'); } diff --git a/src/tools/kdb/meta.c b/src/tools/kdb/meta.c index f31c7691d02..480003908ef 100644 --- a/src/tools/kdb/meta.c +++ b/src/tools/kdb/meta.c @@ -6,12 +6,12 @@ * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) */ -#include #include #include #include #include #include +#include #include #include @@ -23,11 +23,8 @@ #define GET_OPTION(options, name) GET_OPT (options, COMMAND_BASE_KEY (COMMAND_NAME) "/" name) command metaSubcommands[] = { - { "get", addMetaGetSpec, execMetaGet }, - { "ls", addMetaLsSpec, execMetaLs }, - { "rm", addMetaRmSpec, execMetaRm }, - { "set", addMetaSetSpec, execMetaSet }, - { "show", addMetaShowSpec, execMetaShow }, + { "get", addMetaGetSpec, execMetaGet }, { "ls", addMetaLsSpec, execMetaLs }, { "rm", addMetaRmSpec, execMetaRm }, + { "set", addMetaSetSpec, execMetaSet }, { "show", addMetaShowSpec, execMetaShow }, }; void addMetaSpec (KeySet * spec) @@ -54,5 +51,4 @@ int execMeta (KeySet * options, Key * errorKey) } // this cannot happen, since not valid sub-commands are already detected when parsing return 1; - } diff --git a/src/tools/kdb/mv.c b/src/tools/kdb/mv.c index 8f41dd7e84a..41ddbbcbf18 100644 --- a/src/tools/kdb/mv.c +++ b/src/tools/kdb/mv.c @@ -108,7 +108,7 @@ int execMv (KeySet * options, Key * errorKey) strcat (newName, "/"); strcat (newName, &keyName (cur)[sourceNameLen]); } - CLI_PRINT (CLI_LOG_VERBOSE, "-> moving '%s' to '%s'\n", BOLD(keyName (cur)), BOLD(newName)); + CLI_PRINT (CLI_LOG_VERBOSE, "-> moving '%s' to '%s'\n", BOLD (keyName (cur)), BOLD (newName)); Key * tmpKey = keyDup (cur, KEY_CP_ALL); keySetName (tmpKey, newName); ksAppendKey (newConf, tmpKey); diff --git a/src/tools/kdb/mv.h b/src/tools/kdb/mv.h index 3941ce5050f..c15fe9f5b4c 100644 --- a/src/tools/kdb/mv.h +++ b/src/tools/kdb/mv.h @@ -1,10 +1,10 @@ /** -* @file -* -* @brief Header for mv command -* -* @copyright BSD License (see LICENSE.md or https://www.libelektra.org) -*/ + * @file + * + * @brief Header for mv command + * + * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) + */ #ifndef ELEKTRA_KDB_MV_H #define ELEKTRA_KDB_MV_H @@ -12,22 +12,22 @@ #include /** -* Adds options specification of mv command to @spec -* -* @param spec the base spec where the commands spec should be added -*/ + * Adds options specification of mv command to @spec + * + * @param spec the base spec where the commands spec should be added + */ void addMvSpec (KeySet * spec); /** -* Executes the mv command -* -* @param options cli options and arguments as specified in addMvSpec() -* @param errorKey key where errors and warnings should be saved -* -* @retval 0 mv command ran without errors -* @retval 1 errors occurred, keyGetMeta (errorKey, "error/reason") for info -* -*/ + * Executes the mv command + * + * @param options cli options and arguments as specified in addMvSpec() + * @param errorKey key where errors and warnings should be saved + * + * @retval 0 mv command ran without errors + * @retval 1 errors occurred, keyGetMeta (errorKey, "error/reason") for info + * + */ int execMv (KeySet * options, Key * errorKey); // helper functions diff --git a/src/tools/kdb/set.c b/src/tools/kdb/set.c index 56c6a97f056..4db76956655 100644 --- a/src/tools/kdb/set.c +++ b/src/tools/kdb/set.c @@ -54,10 +54,11 @@ int execSet (KeySet * options, Key * errorKey) Key * parentKey = keyNew (name, KEY_END); - if (keyGetNamespace (parentKey) == KEY_NS_NONE || keyGetNamespace (parentKey) == KEY_NS_CASCADING) { + if (keyGetNamespace (parentKey) == KEY_NS_NONE || keyGetNamespace (parentKey) == KEY_NS_CASCADING) + { ret = 1; ELEKTRA_SET_VALIDATION_SYNTACTIC_ERROR (errorKey, "key does not specify a namespace"); - elektraFree ((void*) name); + elektraFree ((void *) name); keyDel (parentKey); return ret; } @@ -95,7 +96,7 @@ int execSet (KeySet * options, Key * errorKey) { printf ("\n"); } - elektraFree ((void*) name); + elektraFree ((void *) name); keyDel (parentKey); ksDel (conf); kdbClose (handle, errorKey); diff --git a/src/tools/kdb/set.h b/src/tools/kdb/set.h index 92912c2b238..3af921614ee 100644 --- a/src/tools/kdb/set.h +++ b/src/tools/kdb/set.h @@ -1,10 +1,10 @@ /** -* @file -* -* @brief KDB set subcommand header -* -* @copyright BSD License (see LICENSE.md or https://www.libelektra.org) -*/ + * @file + * + * @brief KDB set subcommand header + * + * @copyright BSD License (see LICENSE.md or https://www.libelektra.org) + */ #ifndef ELEKTRA_KDB_SET_H #define ELEKTRA_KDB_SET_H @@ -12,22 +12,22 @@ #include /** -* Adds options specification of set command to keySet -* -* @param spec the base spec where the commands spec should be added -*/ + * Adds options specification of set command to keySet + * + * @param spec the base spec where the commands spec should be added + */ void addSetSpec (KeySet * spec); /** -* Runs the set command -* -* @param options cli options and arguments as specified in addSetSpec() -* @param errorKey key where errors and warnings should be saved -* -* @retval 0 set command ran without errors -* @retval 1 errors occurred, keySetMeta (errorKey, "error/reason") for info -* -*/ + * Runs the set command + * + * @param options cli options and arguments as specified in addSetSpec() + * @param errorKey key where errors and warnings should be saved + * + * @retval 0 set command ran without errors + * @retval 1 errors occurred, keySetMeta (errorKey, "error/reason") for info + * + */ int execSet (KeySet * options, Key * errorKey); #endif // ELEKTRA_KDB_SET_H