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 gecommit door Jason A. Donenfeld
bovenliggende 6f2e4400fa
commit f77e2a8cfa
2 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen

Bestand weergeven

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

Bestand weergeven

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