diff options
| author | Michael Biebl <biebl@debian.org> | 2021-02-11 18:11:46 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2021-02-11 18:11:46 +0100 |
| commit | 80ec1decc49c72efec2a8b87c06245c92c0ab807 (patch) | |
| tree | e3b229aa94e8dcf0590f2317664176e7b8f7607b /clients/cli/utils.c | |
| parent | 65f86e8f56267192d42f2b629fc6b0c99fb9cd0c (diff) | |
New upstream version 1.29.90 upstream/1.29.90
Diffstat (limited to 'clients/cli/utils.c')
| -rw-r--r-- | clients/cli/utils.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/clients/cli/utils.c b/clients/cli/utils.c index 2e7b22ce..0a62c35c 100644 --- a/clients/cli/utils.c +++ b/clients/cli/utils.c @@ -1,10 +1,10 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2010 Lennart Poettering * Copyright (C) 2010 - 2018 Red Hat, Inc. */ -#include "nm-default.h" +#include "libnm/nm-default-client.h" #include "utils.h" @@ -374,23 +374,21 @@ nmc_terminal_show_progress(const char *str) char * nmc_colorize(const NmcConfig *nmc_config, NMMetaColor color, const char *fmt, ...) { - va_list args; - char * str, *colored; - const char *ansi_seq = NULL; + va_list args; + gs_free char *str = NULL; + const char * ansi_seq = NULL; va_start(args, fmt); str = g_strdup_vprintf(fmt, args); va_end(args); if (nmc_config->use_colors) - ansi_seq = nmc_config->palette[color]; + ansi_seq = nmc_config->palette.ansi_seq[color]; - if (ansi_seq == NULL) - return str; + if (!ansi_seq) + return g_steal_pointer(&str); - colored = g_strdup_printf("\33[%sm%s\33[0m", ansi_seq, str); - g_free(str); - return colored; + return g_strdup_printf("\33[%sm%s\33[0m", ansi_seq, str); } /* |