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 1, 2023
1 parent 97a7c5c commit 783b546
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
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
3 changes: 1 addition & 2 deletions src/tools/kdb/meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/

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

#include <command.h>
#include <kdb.h>
Expand Down Expand Up @@ -52,5 +52,4 @@ int execMeta (KeySet * options, Key * errorKey)
}
// this cannot happen, since not valid sub-commands are already detected when parsing
return 1;

}
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 783b546

Please sign in to comment.