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/gram.y | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gram.y') diff --git a/src/gram.y b/src/gram.y index 08e87bc..4299388 100755 --- a/src/gram.y +++ b/src/gram.y @@ -635,7 +635,7 @@ command: | S_CELLCOLOR var_or_range STRING { #ifdef USECOLORS - if ( ! atoi(get_conf_value("nocurses"))) + if ( ! get_conf_int("nocurses")) color_cell($2.left.vp->row, $2.left.vp->col, $2.right.vp->row, $2.right.vp->col, $3); #endif scxfree($3); @@ -652,7 +652,7 @@ command: | S_CELLCOLOR STRING { #ifdef USECOLORS - if ( ! atoi(get_conf_value("nocurses"))) + if ( ! get_conf_int("nocurses")) color_cell(currow, curcol, currow, curcol, $2); #endif scxfree($2); @@ -660,13 +660,13 @@ command: | S_UNFORMAT var_or_range { #ifdef USECOLORS - if ( ! atoi(get_conf_value("nocurses"))) unformat($2.left.vp->row, $2.left.vp->col, $2.right.vp->row, $2.right.vp->col); + if ( ! get_conf_int("nocurses")) unformat($2.left.vp->row, $2.left.vp->col, $2.right.vp->row, $2.right.vp->col); #endif } | S_UNFORMAT { #ifdef USECOLORS - if ( ! atoi(get_conf_value("nocurses"))) unformat(currow, curcol, currow, curcol); + if ( ! get_conf_int("nocurses")) unformat(currow, curcol, currow, curcol); #endif } -- cgit v1.2.3