ui-shared: Improve const-ness in API
This is needed to prevent const-related warnings in later patches. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
parent
026980c270
commit
c3f23d4571
76
ui-shared.c
76
ui-shared.c
@ -27,7 +27,7 @@ static char *http_date(time_t t)
|
|||||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_print_error(char *msg)
|
void cgit_print_error(const char *msg)
|
||||||
{
|
{
|
||||||
html("<div class='error'>");
|
html("<div class='error'>");
|
||||||
html_txt(msg);
|
html_txt(msg);
|
||||||
@ -133,7 +133,7 @@ char *cgit_currurl()
|
|||||||
return fmt("%s/", ctx.cfg.virtual_root);
|
return fmt("%s/", ctx.cfg.virtual_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void site_url(char *page, char *search, int ofs)
|
static void site_url(const char *page, const char *search, int ofs)
|
||||||
{
|
{
|
||||||
char *delim = "?";
|
char *delim = "?";
|
||||||
|
|
||||||
@ -160,8 +160,8 @@ static void site_url(char *page, char *search, int ofs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void site_link(char *page, char *name, char *title, char *class,
|
static void site_link(const char *page, const char *name, const char *title,
|
||||||
char *search, int ofs)
|
const char *class, const char *search, int ofs)
|
||||||
{
|
{
|
||||||
html("<a");
|
html("<a");
|
||||||
if (title) {
|
if (title) {
|
||||||
@ -181,14 +181,14 @@ static void site_link(char *page, char *name, char *title, char *class,
|
|||||||
html("</a>");
|
html("</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_index_link(char *name, char *title, char *class, char *pattern,
|
void cgit_index_link(const char *name, const char *title, const char *class,
|
||||||
int ofs)
|
const char *pattern, int ofs)
|
||||||
{
|
{
|
||||||
site_link(NULL, name, title, class, pattern, ofs);
|
site_link(NULL, name, title, class, pattern, ofs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *repolink(char *title, char *class, char *page, char *head,
|
static char *repolink(const char *title, const char *class, const char *page,
|
||||||
char *path)
|
const char *head, const char *path)
|
||||||
{
|
{
|
||||||
char *delim = "?";
|
char *delim = "?";
|
||||||
|
|
||||||
@ -240,8 +240,9 @@ static char *repolink(char *title, char *class, char *page, char *head,
|
|||||||
return fmt("%s", delim);
|
return fmt("%s", delim);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reporevlink(char *page, char *name, char *title, char *class,
|
static void reporevlink(const char *page, const char *name, const char *title,
|
||||||
char *head, char *rev, char *path)
|
const char *class, const char *head, const char *rev,
|
||||||
|
const char *path)
|
||||||
{
|
{
|
||||||
char *delim;
|
char *delim;
|
||||||
|
|
||||||
@ -256,32 +257,33 @@ static void reporevlink(char *page, char *name, char *title, char *class,
|
|||||||
html("</a>");
|
html("</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_summary_link(char *name, char *title, char *class, char *head)
|
void cgit_summary_link(const char *name, const char *title, const char *class,
|
||||||
|
const char *head)
|
||||||
{
|
{
|
||||||
reporevlink(NULL, name, title, class, head, NULL, NULL);
|
reporevlink(NULL, name, title, class, head, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_tag_link(char *name, char *title, char *class, char *head,
|
void cgit_tag_link(const char *name, const char *title, const char *class,
|
||||||
char *rev)
|
const char *head, const char *rev)
|
||||||
{
|
{
|
||||||
reporevlink("tag", name, title, class, head, rev, NULL);
|
reporevlink("tag", name, title, class, head, rev, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_tree_link(char *name, char *title, char *class, char *head,
|
void cgit_tree_link(const char *name, const char *title, const char *class,
|
||||||
char *rev, char *path)
|
const char *head, const char *rev, const char *path)
|
||||||
{
|
{
|
||||||
reporevlink("tree", name, title, class, head, rev, path);
|
reporevlink("tree", name, title, class, head, rev, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_plain_link(char *name, char *title, char *class, char *head,
|
void cgit_plain_link(const char *name, const char *title, const char *class,
|
||||||
char *rev, char *path)
|
const char *head, const char *rev, const char *path)
|
||||||
{
|
{
|
||||||
reporevlink("plain", name, title, class, head, rev, path);
|
reporevlink("plain", name, title, class, head, rev, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_log_link(char *name, char *title, char *class, char *head,
|
void cgit_log_link(const char *name, const char *title, const char *class,
|
||||||
char *rev, char *path, int ofs, char *grep, char *pattern,
|
const char *head, const char *rev, const char *path,
|
||||||
int showmsg)
|
int ofs, const char *grep, const char *pattern, int showmsg)
|
||||||
{
|
{
|
||||||
char *delim;
|
char *delim;
|
||||||
|
|
||||||
@ -316,8 +318,8 @@ void cgit_log_link(char *name, char *title, char *class, char *head,
|
|||||||
html("</a>");
|
html("</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_commit_link(char *name, char *title, char *class, char *head,
|
void cgit_commit_link(char *name, const char *title, const char *class,
|
||||||
char *rev, int toggle_ssdiff)
|
const char *head, const char *rev, int toggle_ssdiff)
|
||||||
{
|
{
|
||||||
if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
|
if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) {
|
||||||
name[ctx.cfg.max_msg_len] = '\0';
|
name[ctx.cfg.max_msg_len] = '\0';
|
||||||
@ -344,21 +346,22 @@ void cgit_commit_link(char *name, char *title, char *class, char *head,
|
|||||||
html("</a>");
|
html("</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_refs_link(char *name, char *title, char *class, char *head,
|
void cgit_refs_link(const char *name, const char *title, const char *class,
|
||||||
char *rev, char *path)
|
const char *head, const char *rev, const char *path)
|
||||||
{
|
{
|
||||||
reporevlink("refs", name, title, class, head, rev, path);
|
reporevlink("refs", name, title, class, head, rev, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_snapshot_link(char *name, char *title, char *class, char *head,
|
void cgit_snapshot_link(const char *name, const char *title, const char *class,
|
||||||
char *rev, char *archivename)
|
const char *head, const char *rev,
|
||||||
|
const char *archivename)
|
||||||
{
|
{
|
||||||
reporevlink("snapshot", name, title, class, head, rev, archivename);
|
reporevlink("snapshot", name, title, class, head, rev, archivename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_diff_link(char *name, char *title, char *class, char *head,
|
void cgit_diff_link(const char *name, const char *title, const char *class,
|
||||||
char *new_rev, char *old_rev, char *path,
|
const char *head, const char *new_rev, const char *old_rev,
|
||||||
int toggle_ssdiff)
|
const char *path, int toggle_ssdiff)
|
||||||
{
|
{
|
||||||
char *delim;
|
char *delim;
|
||||||
|
|
||||||
@ -384,14 +387,14 @@ void cgit_diff_link(char *name, char *title, char *class, char *head,
|
|||||||
html("</a>");
|
html("</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_patch_link(char *name, char *title, char *class, char *head,
|
void cgit_patch_link(const char *name, const char *title, const char *class,
|
||||||
char *rev)
|
const char *head, const char *rev)
|
||||||
{
|
{
|
||||||
reporevlink("patch", name, title, class, head, rev, NULL);
|
reporevlink("patch", name, title, class, head, rev, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_stats_link(char *name, char *title, char *class, char *head,
|
void cgit_stats_link(const char *name, const char *title, const char *class,
|
||||||
char *path)
|
const char *head, const char *path)
|
||||||
{
|
{
|
||||||
reporevlink("stats", name, title, class, head, NULL, path);
|
reporevlink("stats", name, title, class, head, NULL, path);
|
||||||
}
|
}
|
||||||
@ -417,7 +420,7 @@ void cgit_object_link(struct object *obj)
|
|||||||
reporevlink(page, name, NULL, NULL, ctx.qry.head, fullrev, NULL);
|
reporevlink(page, name, NULL, NULL, ctx.qry.head, fullrev, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_print_date(time_t secs, char *format, int local_time)
|
void cgit_print_date(time_t secs, const char *format, int local_time)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
struct tm *time;
|
struct tm *time;
|
||||||
@ -432,7 +435,7 @@ void cgit_print_date(time_t secs, char *format, int local_time)
|
|||||||
html_txt(buf);
|
html_txt(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_print_age(time_t t, time_t max_relative, char *format)
|
void cgit_print_age(time_t t, time_t max_relative, const char *format)
|
||||||
{
|
{
|
||||||
time_t now, secs;
|
time_t now, secs;
|
||||||
|
|
||||||
@ -611,7 +614,8 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cgit_add_hidden_formfields(int incl_head, int incl_search, char *page)
|
void cgit_add_hidden_formfields(int incl_head, int incl_search,
|
||||||
|
const char *page)
|
||||||
{
|
{
|
||||||
char *url;
|
char *url;
|
||||||
|
|
||||||
|
69
ui-shared.h
69
ui-shared.h
@ -10,36 +10,47 @@ extern char *cgit_fileurl(const char *reponame, const char *pagename,
|
|||||||
extern char *cgit_pageurl(const char *reponame, const char *pagename,
|
extern char *cgit_pageurl(const char *reponame, const char *pagename,
|
||||||
const char *query);
|
const char *query);
|
||||||
|
|
||||||
extern void cgit_index_link(char *name, char *title, char *class,
|
extern void cgit_index_link(const char *name, const char *title,
|
||||||
char *pattern, int ofs);
|
const char *class, const char *pattern, int ofs);
|
||||||
extern void cgit_summary_link(char *name, char *title, char *class, char *head);
|
extern void cgit_summary_link(const char *name, const char *title,
|
||||||
extern void cgit_tag_link(char *name, char *title, char *class, char *head,
|
const char *class, const char *head);
|
||||||
char *rev);
|
extern void cgit_tag_link(const char *name, const char *title,
|
||||||
extern void cgit_tree_link(char *name, char *title, char *class, char *head,
|
const char *class, const char *head,
|
||||||
char *rev, char *path);
|
const char *rev);
|
||||||
extern void cgit_plain_link(char *name, char *title, char *class, char *head,
|
extern void cgit_tree_link(const char *name, const char *title,
|
||||||
char *rev, char *path);
|
const char *class, const char *head,
|
||||||
extern void cgit_log_link(char *name, char *title, char *class, char *head,
|
const char *rev, const char *path);
|
||||||
char *rev, char *path, int ofs, char *grep,
|
extern void cgit_plain_link(const char *name, const char *title,
|
||||||
char *pattern, int showmsg);
|
const char *class, const char *head,
|
||||||
extern void cgit_commit_link(char *name, char *title, char *class, char *head,
|
const char *rev, const char *path);
|
||||||
char *rev, int toggle_ssdiff);
|
extern void cgit_log_link(const char *name, const char *title,
|
||||||
extern void cgit_patch_link(char *name, char *title, char *class, char *head,
|
const char *class, const char *head, const char *rev,
|
||||||
char *rev);
|
const char *path, int ofs, const char *grep,
|
||||||
extern void cgit_refs_link(char *name, char *title, char *class, char *head,
|
const char *pattern, int showmsg);
|
||||||
char *rev, char *path);
|
extern void cgit_commit_link(char *name, const char *title,
|
||||||
extern void cgit_snapshot_link(char *name, char *title, char *class,
|
const char *class, const char *head,
|
||||||
char *head, char *rev, char *archivename);
|
const char *rev, int toggle_ssdiff);
|
||||||
extern void cgit_diff_link(char *name, char *title, char *class, char *head,
|
extern void cgit_patch_link(const char *name, const char *title,
|
||||||
char *new_rev, char *old_rev, char *path,
|
const char *class, const char *head,
|
||||||
int toggle_ssdiff);
|
const char *rev);
|
||||||
extern void cgit_stats_link(char *name, char *title, char *class, char *head,
|
extern void cgit_refs_link(const char *name, const char *title,
|
||||||
char *path);
|
const char *class, const char *head,
|
||||||
|
const char *rev, const char *path);
|
||||||
|
extern void cgit_snapshot_link(const char *name, const char *title,
|
||||||
|
const char *class, const char *head,
|
||||||
|
const char *rev, const char *archivename);
|
||||||
|
extern void cgit_diff_link(const char *name, const char *title,
|
||||||
|
const char *class, const char *head,
|
||||||
|
const char *new_rev, const char *old_rev,
|
||||||
|
const char *path, int toggle_ssdiff);
|
||||||
|
extern void cgit_stats_link(const char *name, const char *title,
|
||||||
|
const char *class, const char *head,
|
||||||
|
const char *path);
|
||||||
extern void cgit_object_link(struct object *obj);
|
extern void cgit_object_link(struct object *obj);
|
||||||
|
|
||||||
extern void cgit_print_error(char *msg);
|
extern void cgit_print_error(const char *msg);
|
||||||
extern void cgit_print_date(time_t secs, char *format, int local_time);
|
extern void cgit_print_date(time_t secs, const char *format, int local_time);
|
||||||
extern void cgit_print_age(time_t t, time_t max_relative, char *format);
|
extern void cgit_print_age(time_t t, time_t max_relative, const char *format);
|
||||||
extern void cgit_print_http_headers(struct cgit_context *ctx);
|
extern void cgit_print_http_headers(struct cgit_context *ctx);
|
||||||
extern void cgit_print_docstart(struct cgit_context *ctx);
|
extern void cgit_print_docstart(struct cgit_context *ctx);
|
||||||
extern void cgit_print_docend();
|
extern void cgit_print_docend();
|
||||||
@ -48,5 +59,5 @@ extern void cgit_print_filemode(unsigned short mode);
|
|||||||
extern void cgit_print_snapshot_links(const char *repo, const char *head,
|
extern void cgit_print_snapshot_links(const char *repo, const char *head,
|
||||||
const char *hex, int snapshots);
|
const char *hex, int snapshots);
|
||||||
extern void cgit_add_hidden_formfields(int incl_head, int incl_search,
|
extern void cgit_add_hidden_formfields(int incl_head, int incl_search,
|
||||||
char *page);
|
const char *page);
|
||||||
#endif /* UI_SHARED_H */
|
#endif /* UI_SHARED_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user