ui-shared: return value of cgit_hosturl is not const

Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
Christian Hesse 2015-10-09 13:15:50 +02:00 committed by Jason A. Donenfeld
parent 6f2e4400fa
commit f77e2a8cfa
2 changed files with 4 additions and 4 deletions

View File

@ -54,14 +54,14 @@ const char *cgit_httpscheme(void)
return "http://";
}
const char *cgit_hosturl(void)
char *cgit_hosturl(void)
{
if (ctx.env.http_host)
return ctx.env.http_host;
return xstrdup(ctx.env.http_host);
if (!ctx.env.server_name)
return NULL;
if (!ctx.env.server_port || atoi(ctx.env.server_port) == 80)
return ctx.env.server_name;
return xstrdup(ctx.env.server_name);
return fmtalloc("%s:%s", ctx.env.server_name, ctx.env.server_port);
}

View File

@ -2,7 +2,7 @@
#define UI_SHARED_H
extern const char *cgit_httpscheme();
extern const char *cgit_hosturl();
extern char *cgit_hosturl();
extern const char *cgit_rooturl();
extern char *cgit_currenturl();
extern const char *cgit_loginurl();