Diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Keep the permission triplet beside its one caller
Diffstat (limited to 'source')
-rw-r--r--source/html.c9
-rw-r--r--source/html.h1
-rw-r--r--source/ui-shared.c11
3 files changed, 8 insertions, 13 deletions
diff --git a/source/html.c b/source/html.c
index d13ac5b..437a0ae 100644
--- a/source/html.c
+++ b/source/html.c
@@ -531,15 +531,6 @@ void html_link_close(void)
html("</a>");
}
-/*
- * Render one permission triplet, so a caller prints a whole mode by passing it
- * shifted right by six, then by three, then unshifted.
- */
-void html_fileperm(unsigned short mode)
-{
- htmlf("%c%c%c", (mode & 4 ? 'r' : '-'), (mode & 2 ? 'w' : '-'), (mode & 1 ? 'x' : '-'));
-}
-
int html_include(const char *filename)
{
FILE *f;
diff --git a/source/html.h b/source/html.h
index 9cad3a6..77f84b4 100644
--- a/source/html.h
+++ b/source/html.h
@@ -99,7 +99,6 @@ extern void html_option(const char *value, const char *text, const char *selecte
extern void html_intoption(int value, const char *text, int selected_value);
extern void html_link_open(const char *url, const char *title, const char *class);
extern void html_link_close(void);
-extern void html_fileperm(unsigned short mode);
extern int html_include(const char *filename);
extern void http_parse_querystring(const char *txt, void (*fn)(const char *name, const char *value));
diff --git a/source/ui-shared.c b/source/ui-shared.c
index b2a09ff..b2b7245 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -1711,6 +1711,11 @@ void cgit_print_pageheader(void)
html("<main class='content'>\n");
}
+static void print_fileperm(unsigned short mode)
+{
+ htmlf("%c%c%c", (mode & 4 ? 'r' : '-'), (mode & 2 ? 'w' : '-'), (mode & 1 ? 'x' : '-'));
+}
+
void cgit_print_filemode(unsigned short mode)
{
if (S_ISDIR(mode))
@@ -1721,9 +1726,9 @@ void cgit_print_filemode(unsigned short mode)
html("m");
else
html("-");
- html_fileperm(mode >> 6);
- html_fileperm(mode >> 3);
- html_fileperm(mode);
+ print_fileperm(mode >> 6);
+ print_fileperm(mode >> 3);
+ print_fileperm(mode);
}
// The tag names and their stems, a stem being the name with any leading v or V