Skip to content

Commit

Permalink
infostore: general tidyup
Browse files Browse the repository at this point in the history
Tidy up some of the code; no functional changes.
  • Loading branch information
ThomasAdam committed Nov 19, 2024
1 parent c27e389 commit 4ee5488
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions fvwm/infostore.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,12 @@ void insert_metainfo(char *key, char *value)

static void delete_metainfo(const char *key)
{
MetaInfo *mi = NULL;
MetaInfo *mi = NULL, *mi1;

TAILQ_FOREACH(mi, &meta_info_q, entry)
{
if (StrEquals(mi->key, key))
break;
}

if (mi != NULL)
TAILQ_FOREACH_SAFE(mi, &meta_info_q, entry, mi1)
{
if (!StrEquals(mi->key, key))
continue;
TAILQ_REMOVE(&meta_info_q, mi, entry);

free(mi->key);
Expand Down Expand Up @@ -138,28 +134,14 @@ void print_infostore(void)
/* ---------------------------- builtin commands --------------------------- */
void CMD_InfoStoreAdd(F_CMD_ARGS)
{
char *key, *value;
char *key = NULL, *value = NULL;
char *token;

token = PeekToken(action, &action);
key = value = NULL;

if (token)
key = strdup(token);
key = fxstrdup(token);

token = PeekToken(action, &action);

if (token)
value = strdup(token);

if (!key || !value)
{
fvwm_debug(__func__, "Bad arguments given.");
if (key)
free(key);

return;
}
value = fxstrdup(token);

insert_metainfo(key, value);
free(key);
Expand Down

0 comments on commit 4ee5488

Please sign in to comment.