summaryrefslogtreecommitdiffstats
path: root/src/color.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2021-03-20 17:02:22 -0400
committerNicolas Pitre <nico@fluxnic.net>2021-03-20 20:01:22 -0400
commit8657daadd3658f98bc72729ae1afc8ecf54b391d (patch)
tree2b69503f0e4471cdae28128ee423bb5d9873307b /src/color.c
parent5ab0f201ee0b5631939c30e323c2241007902dc8 (diff)
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
Diffstat (limited to 'src/color.c')
-rw-r--r--src/color.c4
1 files changed, 2 insertions, 2 deletions
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;