From 8657daadd3658f98bc72729ae1afc8ecf54b391d Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Sat, 20 Mar 2021 17:02:22 -0400 Subject: stop performing atoi() repeatedly on config values Now that we store both the string and the numeric value for every config entries, let's grab those values directly. This should save quite some processing cycles. Those changes were performed with the following command: sed -e 's/atoi(get_conf_value *(\([^)]*\)))/get_conf_int(\1)/g' -i *.c *.y --- src/color.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/color.c') diff --git a/src/color.c b/src/color.c index 5509018..092a3a5 100644 --- a/src/color.c +++ b/src/color.c @@ -567,7 +567,7 @@ int redefine_color(char * color, int r, int g, int b) { #if defined(NCURSES) && defined(USECOLORS) extern void sig_winchg(); if ( - ! atoi(get_conf_value("nocurses")) + ! get_conf_int("nocurses") && has_colors() && can_change_color() ) { char * s = get(d_colors_param, color); @@ -604,7 +604,7 @@ int redefine_color(char * color, int r, int g, int b) { int define_color(char * color, int r, int g, int b) { #if defined(NCURSES) && defined(USECOLORS) - if (atoi(get_conf_value("nocurses"))) { + if (get_conf_int("nocurses")) { // this should not be alerted. //sc_error("Could not define color %s. Not using NCURSES.", color); return -1; -- cgit v1.2.3