From 8a35f9a21fe0c58aabf964c4863e758c43065c27 Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Sun, 17 Jan 2021 23:52:11 -0700 Subject: j2_cat:switch printf to puts where appropriate This should reduce cpu cycles since the format strings were unused other than just to print to stdout. --- src/j2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/j2.c b/src/j2.c index 0ed7db8..4803abb 100644 --- a/src/j2.c +++ b/src/j2.c @@ -78,7 +78,7 @@ int j2_cat(char* path) { varstart = j2_strstr(line); if(!varstart) { - printf("%s", line); + fputs(line, stdout); continue; } varend = j2_readvar(varstart, buf, J2_MAXBUF); @@ -87,13 +87,13 @@ int j2_cat(char* path) { // (this overwrites the first { that opens the variable def) *varstart = '\0'; // Because of the inserted null byte, this will print from byte 0 to there - printf("%s", line); + fputs(line, stdout); // Execute the variable directive and print the output if(strncmp(buf, "shell ", 6) == 0) { // Execute the provided shell command and print that value = runsh(&buf[6]); - printf("%s", value); + fputs(value, stdout); free(value); } else { // Print the referenced environment variable -- cgit v1.2.3