summaryrefslogtreecommitdiffstats
path: root/src/xlsx.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/xlsx.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/xlsx.c')
-rw-r--r--src/xlsx.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/xlsx.c b/src/xlsx.c
index f1d6ce6..0835a9e 100644
--- a/src/xlsx.c
+++ b/src/xlsx.c
@@ -260,7 +260,7 @@ void get_sheet_data(xmlDocPtr doc, xmlDocPtr doc_strings, xmlDocPtr doc_styles)
)) {
long l = strtol((char *) child_node->xmlChildrenNode->xmlChildrenNode->content, (char **) NULL, 10);
- swprintf(line_interp, FBUFLEN, L"let %s%d=%.15ld", coltoa(c), r, (l - 25568) * 86400 - atoi(get_conf_value("tm_gmtoff")));
+ swprintf(line_interp, FBUFLEN, L"let %s%d=%.15ld", coltoa(c), r, (l - 25568) * 86400 - get_conf_int("tm_gmtoff"));
send_to_interp(line_interp);
struct ent * n = lookat(r, c);
n->format = 0;
@@ -276,7 +276,7 @@ void get_sheet_data(xmlDocPtr doc, xmlDocPtr doc_strings, xmlDocPtr doc_styles)
(atoi(fmtId) >= 18 && atoi(fmtId) <= 21)
)) {
double l = atof((char *) child_node->xmlChildrenNode->xmlChildrenNode->content);
- swprintf(line_interp, FBUFLEN, L"let %s%d=%.15f", coltoa(c), r, (l - atoi(get_conf_value("tm_gmtoff")) * 1.0 / 60 / 60 / 24) * 86400);
+ swprintf(line_interp, FBUFLEN, L"let %s%d=%.15f", coltoa(c), r, (l - get_conf_int("tm_gmtoff") * 1.0 / 60 / 60 / 24) * 86400);
send_to_interp(line_interp);
struct ent * n = lookat(r, c);
n->format = 0;
@@ -298,7 +298,7 @@ void get_sheet_data(xmlDocPtr doc, xmlDocPtr doc_strings, xmlDocPtr doc_styles)
child_node->xmlChildrenNode != NULL && ! strcmp((char *) child_node->xmlChildrenNode->name, "f")) {
// handle the formula if that is whats desidered!!
- if (atoi(get_conf_value("xlsx_readformulas"))) {
+ if (get_conf_int("xlsx_readformulas")) {
char * formula = (char *) child_node->xmlChildrenNode->xmlChildrenNode->content;
char * strf;
@@ -666,10 +666,10 @@ int export_xlsx(char * filename, int r0, int c0, int rn, int cn) {
strcpy(sc_format, st);
free(st);
format_set_num_format(format, sc_format);
- worksheet_write_number(worksheet, row-1, col, (((*pp)->v + atoi(get_conf_value("tm_gmtoff"))) / 86400 + 25568) , format);
+ worksheet_write_number(worksheet, row-1, col, (((*pp)->v + get_conf_int("tm_gmtoff")) / 86400 + 25568) , format);
// formula
- } else if ((*pp) && (*pp)->expr && atoi(get_conf_value("xlsx_readformulas"))) {
+ } else if ((*pp) && (*pp)->expr && get_conf_int("xlsx_readformulas")) {
linelim = 0;
editexp((*pp)->row, (*pp)->col);
linelim = -1;