Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Mar 2, 2023
1 parent 32ed763 commit 6b01777
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 57 deletions.
5 changes: 3 additions & 2 deletions src/tools/kdb/meta-rm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions src/tools/kdb/meta-set.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/tools/kdb/meta-show.c
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}


Expand Down
10 changes: 3 additions & 7 deletions src/tools/kdb/meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/

#include <meta.h>
#include <meta-get.h>
#include <meta-ls.h>
#include <meta-rm.h>
#include <meta-set.h>
#include <meta-show.h>
#include <meta.h>

#include <command.h>
#include <kdb.h>
Expand All @@ -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)
Expand All @@ -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;

}
2 changes: 1 addition & 1 deletion src/tools/kdb/mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
38 changes: 19 additions & 19 deletions src/tools/kdb/mv.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
/**
* @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

#include <kdb.h>

/**
* 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
Expand Down
7 changes: 4 additions & 3 deletions src/tools/kdb/set.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
38 changes: 19 additions & 19 deletions src/tools/kdb/set.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
/**
* @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

#include <kdb.h>

/**
* 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

0 comments on commit 6b01777

Please sign in to comment.