Introduction
Introduction Statistics Contact Development Disclaimer Help
micro-optimization: fputc (function) -> putc (macro/inline function) - stagit-g…
git clone git://git.codemadness.org/stagit-gopher
Log
Files
Refs
README
LICENSE
---
commit 7b93d02cd8f26ab9a25d967c72c359a22c91eb74
parent 2a7c95ac9f240d3e7d59d74a319ff47f37d4a625
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 9 Jan 2021 14:19:53 +0100
micro-optimization: fputc (function) -> putc (macro/inline function)
Diffstat:
M stagit-gopher.c | 34 ++++++++++++++++-------------…
1 file changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -417,7 +417,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);
}
}
}
@@ -431,12 +431,12 @@ gphtextnl(FILE *fp, const char *s, size_t len)
for (i = 0; s[i] && i < len; i++) {
/* escape with 't' at the start of a line */
if (!n && (s[i] == 't' || s[i] == '['))
- fputc('t', fp);
+ putc('t', fp);
switch (s[i]) {
case '\t': fputs(" ", fp);
case '\r': break;
- default: fputc(s[i], fp);
+ default: putc(s[i], fp);
}
n = (s[i] != '\n');
}
@@ -458,7 +458,7 @@ gphtext(FILE *fp, const char *s, size_t len)
fputs(" ", fp);
break;
default:
- fputc(*s, fp);
+ putc(*s, fp);
break;
}
}
@@ -482,7 +482,7 @@ gphlink(FILE *fp, const char *s, size_t len)
fputs("\\|", fp);
break;
default:
- fputc(*s, fp);
+ putc(*s, fp);
break;
}
}
@@ -558,7 +558,7 @@ printtimeshort(FILE *fp, const git_time *intime)
void
writeheader(FILE *fp, const char *title)
{
- fputc('t', fp);
+ putc('t', fp);
gphtext(fp, title, strlen(title));
if (title[0] && strippedname[0])
fputs(" - ", fp);
@@ -612,7 +612,7 @@ writeblobgph(FILE *fp, const git_blob *blob)
switch (s[j]) {
case '\r': break;
case '\t': fputs(" ", fp); break;
- default: fputc(s[j], fp);
+ default: putc(s[j], fp);
}
}
prev = i + 1;
@@ -625,7 +625,7 @@ writeblobgph(FILE *fp, const git_blob *blob)
switch (s[j]) {
case '\r': break;
case '\t': fputs(" ", fp); break;
- default: fputc(s[j], fp);
+ default: putc(s[j], fp);
}
}
}
@@ -654,12 +654,12 @@ printcommit(FILE *fp, struct commitinfo *ci)
fputs("|server|port]\n", fp);
fputs("Date: ", fp);
printtime(fp, &(ci->author->when));
- fputc('\n', fp);
+ putc('\n', fp);
}
if (ci->msg) {
- fputc('\n', fp);
+ putc('\n', fp);
gphtextnl(fp, ci->msg, strlen(ci->msg));
- fputc('\n', fp);
+ putc('\n', fp);
}
}
@@ -761,9 +761,9 @@ printshowfile(FILE *fp, struct commitinfo *ci)
if (git_patch_get_hunk(&hunk, &nhunklines, patch, j))
break;
- fputc('t', fp);
+ putc('t', fp);
gphtext(fp, hunk->header, hunk->header_len);
- fputc('\n', fp);
+ putc('\n', fp);
for (k = 0; ; k++) {
if (git_patch_get_line_in_hunk(&line, patch, j…
@@ -775,7 +775,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
else
fputs(" ", fp);
gphtext(fp, line->content, line->content_len);
- fputc('\n', fp);
+ putc('\n', fp);
}
}
}
@@ -912,10 +912,10 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const ch…
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);
@@ -984,7 +984,7 @@ writeblob(git_object *obj, const char *fpath, const char *f…
fp = efopen(fpath, "w");
writeheader(fp, filename);
- fputc('t', fp);
+ putc('t', fp);
gphtext(fp, filename, strlen(filename));
fprintf(fp, " (%zuB)\n", filesize);
fputs("---\n", fp);
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.