micro-optimization: fputc (function) -> putc (macro/inline function)
authorHiltjo Posthuma <hiltjo@codemadness.org>
Sat, 9 Jan 2021 13:59:53 +0000 (14:59 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Sat, 9 Jan 2021 13:59:53 +0000 (14:59 +0100)
stagit-index.c
stagit.c

index bb0ad3c240fc117f31c07697494348061ccf5502..5cf905386de9e356999b6ef3542115cb841ba707 100644 (file)
@@ -41,7 +41,7 @@ xmlencode(FILE *fp, const char *s, size_t len)
                case '\'': fputs("&#39;" , fp); break;
                case '&':  fputs("&amp;",  fp); break;
                case '"':  fputs("&quot;", fp); break;
-               default:   fputc(*s, fp);
+               default:   putc(*s, fp);
                }
        }
 }
index d38aaa4bb495ba631263eb8f5a81df6eaa236bdd..98035e9c24012a2f4a0b03581fb67e2e0ea63051 100644 (file)
--- a/stagit.c
+++ b/stagit.c
@@ -371,7 +371,7 @@ xmlencode(FILE *fp, const char *s, size_t len)
                case '\'': fputs("&#39;",  fp); break;
                case '&':  fputs("&amp;",  fp); break;
                case '"':  fputs("&quot;", fp); break;
-               default:   fputc(*s, fp);
+               default:   putc(*s, fp);
                }
        }
 }
@@ -552,12 +552,12 @@ printcommit(FILE *fp, struct commitinfo *ci)
                xmlencode(fp, ci->author->email, strlen(ci->author->email));
                fputs("</a>&gt;\n<b>Date:</b>   ", fp);
                printtime(fp, &(ci->author->when));
-               fputc('\n', fp);
+               putc('\n', fp);
        }
        if (ci->msg) {
-               fputc('\n', fp);
+               putc('\n', fp);
                xmlencode(fp, ci->msg, strlen(ci->msg));
-               fputc('\n', fp);
+               putc('\n', fp);
        }
 }
 
@@ -676,7 +676,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
                                        fprintf(fp, "<a href=\"#h%zu-%zu-%zu\" id=\"h%zu-%zu-%zu\" class=\"d\">-",
                                                i, j, k, i, j, k);
                                else
-                                       fputc(' ', fp);
+                                       putc(' ', fp);
                                xmlencode(fp, line->content, line->content_len);
                                if (line->old_lineno == -1 || line->new_lineno == -1)
                                        fputs("</a>", fp);
@@ -829,10 +829,10 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char *tag)
                xmlencode(fp, ci->author->email, strlen(ci->author->email));
                fputs("&gt;\nDate:   ", fp);
                printtime(fp, &(ci->author->when));
-               fputc('\n', fp);
+               putc('\n', fp);
        }
        if (ci->msg) {
-               fputc('\n', fp);
+               putc('\n', fp);
                xmlencode(fp, ci->msg, strlen(ci->msg));
        }
        fputs("\n</content>\n</entry>\n", fp);