paleofetch

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 69e6815a04a93b36a6303c4784f7cfe070e097a4
parent b881e6dfc5509116a7046bcf6d77000aea09d278
Author: sam-barr <samfbarr@outlook.com>
Date:   Thu, 23 Apr 2020 15:16:31 -0500

code duplication, changed default config

Having two entries with the same name breaks caching,
so it shouldn't be in the default config.

Diffstat:
Mconfig.h | 1-
Mpaleofetch.c | 24+++++-------------------
2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/config.h b/config.h @@ -18,7 +18,6 @@ SPACER \ { "CPU: ", get_cpu, true }, \ { "GPU: ", get_gpu1, true }, \ - { "GPU: ", get_gpu2, true }, \ { "Memory: ", get_memory, false }, \ SPACER \ { "", get_colors1, false }, \ diff --git a/paleofetch.c b/paleofetch.c @@ -395,34 +395,20 @@ char *find_gpu(int index) { dev = dev->next; } - if (found == false) { - strncpy(gpu, "", BUF_SIZE); // empty string, so it will not be printed - } + if (found == false) *gpu = '\0'; // empty string, so it will not be printed pci_cleanup(pacc); + remove_substring(gpu, "Corporation", 11); + truncate_spaces(gpu); return gpu; } char *get_gpu1() { - char *gpu1 = NULL; - - gpu1 = find_gpu(0); - - remove_substring(gpu1, "Corporation", 11); - truncate_spaces(gpu1); - - return gpu1; + return find_gpu(0); } char *get_gpu2() { - char *gpu2 = NULL; - - gpu2 = find_gpu(1); - - remove_substring(gpu2, "Corporation", 11); - truncate_spaces(gpu2); - - return gpu2; + return find_gpu(1); } char *get_memory() {