Author: Christian Hesse <mail@eworm.de>
ui-shared: return value of cgit_hosturl is not const Signed-off-by: Christian Hesse <mail@eworm.de>
ui-shared.c | 6 +++--- ui-shared.h | 2 +-
diff --git a/ui-shared.c b/ui-shared.c index f6d38deb620de372456ea11d89eecfa6aa247f45..09c34fdea137ec8363a916f5ff21fe429eea6448 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -54,14 +54,14 @@ else 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); } diff --git a/ui-shared.h b/ui-shared.h index 4121416be16585f1ea8952a5ae590cb7f8edc496..474e0c5ef2c008a6b13b865a30cfa3f4ee7aef22 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -2,7 +2,7 @@ #ifndef UI_SHARED_H #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();