List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH 1/3] ui-repolist: fix memory leak
@ 2016-10-10 18:36 list
  2016-10-10 18:36 ` [PATCH 2/3] shared: remove unused function strrpart() list
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: list @ 2016-10-10 18:36 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 ui-repolist.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui-repolist.c b/ui-repolist.c
index 1d9a7f7..7158bf7 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -343,13 +343,15 @@ void cgit_print_repolist(void)
 				html_txt(ctx.repo->owner);
 				cgit_close_filter(ctx.repo->owner_filter);
 			} else {
+				char *currenturl = cgit_currenturl();
 				html("<a href='");
-				html_attr(cgit_currenturl());
+				html_attr(currenturl);
 				html("?q=");
 				html_url_arg(ctx.repo->owner);
 				html("'>");
 				html_txt(ctx.repo->owner);
 				html("</a>");
+				free(currenturl);
 			}
 			html("</td><td>");
 		}
-- 
2.10.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] shared: remove unused function strrpart()
  2016-10-10 18:36 [PATCH 1/3] ui-repolist: fix memory leak list
@ 2016-10-10 18:36 ` list
  2016-10-12 11:18   ` Jason
  2016-10-10 18:36 ` [PATCH 3/3] shared: remove unused function strlpart() list
  2016-10-12 11:18 ` [PATCH 1/3] ui-repolist: fix memory leak Jason
  2 siblings, 1 reply; 6+ messages in thread
From: list @ 2016-10-10 18:36 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 cgit.h   |  1 -
 shared.c | 15 ---------------
 2 files changed, 16 deletions(-)

diff --git a/cgit.h b/cgit.h
index df42312..bef6e5f 100644
--- a/cgit.h
+++ b/cgit.h
@@ -334,7 +334,6 @@ extern int chk_non_negative(int result, char *msg);
 extern char *trim_end(const char *str, char c);
 extern char *ensure_end(const char *str, char c);
 extern char *strlpart(char *txt, int maxlen);
-extern char *strrpart(char *txt, int maxlen);
 
 extern void strbuf_ensure_end(struct strbuf *sb, char c);
 
diff --git a/shared.c b/shared.c
index 571fbba..8d08435 100644
--- a/shared.c
+++ b/shared.c
@@ -158,21 +158,6 @@ char *strlpart(char *txt, int maxlen)
 	return result;
 }
 
-char *strrpart(char *txt, int maxlen)
-{
-	char *result;
-
-	if (!txt)
-		return txt;
-
-	if (strlen(txt) <= maxlen)
-		return txt;
-	result = xmalloc(maxlen + 1);
-	memcpy(result + 3, txt + strlen(txt) - maxlen + 4, maxlen - 3);
-	result[0] = result[1] = result[2] = '.';
-	return result;
-}
-
 void cgit_add_ref(struct reflist *list, struct refinfo *ref)
 {
 	size_t size;
-- 
2.10.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] shared: remove unused function strlpart()
  2016-10-10 18:36 [PATCH 1/3] ui-repolist: fix memory leak list
  2016-10-10 18:36 ` [PATCH 2/3] shared: remove unused function strrpart() list
@ 2016-10-10 18:36 ` list
  2016-10-12 11:18   ` Jason
  2016-10-12 11:18 ` [PATCH 1/3] ui-repolist: fix memory leak Jason
  2 siblings, 1 reply; 6+ messages in thread
From: list @ 2016-10-10 18:36 UTC (permalink / raw)


From: Christian Hesse <mail at eworm.de>

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 cgit.h   |  1 -
 shared.c | 16 ----------------
 2 files changed, 17 deletions(-)

diff --git a/cgit.h b/cgit.h
index bef6e5f..fbc6c6a 100644
--- a/cgit.h
+++ b/cgit.h
@@ -333,7 +333,6 @@ extern int chk_non_negative(int result, char *msg);
 
 extern char *trim_end(const char *str, char c);
 extern char *ensure_end(const char *str, char c);
-extern char *strlpart(char *txt, int maxlen);
 
 extern void strbuf_ensure_end(struct strbuf *sb, char c);
 
diff --git a/shared.c b/shared.c
index 8d08435..c63f1e3 100644
--- a/shared.c
+++ b/shared.c
@@ -142,22 +142,6 @@ void strbuf_ensure_end(struct strbuf *sb, char c)
 		strbuf_addch(sb, c);
 }
 
-char *strlpart(char *txt, int maxlen)
-{
-	char *result;
-
-	if (!txt)
-		return txt;
-
-	if (strlen(txt) <= maxlen)
-		return txt;
-	result = xmalloc(maxlen + 1);
-	memcpy(result, txt, maxlen - 3);
-	result[maxlen-1] = result[maxlen-2] = result[maxlen-3] = '.';
-	result[maxlen] = '\0';
-	return result;
-}
-
 void cgit_add_ref(struct reflist *list, struct refinfo *ref)
 {
 	size_t size;
-- 
2.10.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] ui-repolist: fix memory leak
  2016-10-10 18:36 [PATCH 1/3] ui-repolist: fix memory leak list
  2016-10-10 18:36 ` [PATCH 2/3] shared: remove unused function strrpart() list
  2016-10-10 18:36 ` [PATCH 3/3] shared: remove unused function strlpart() list
@ 2016-10-12 11:18 ` Jason
  2 siblings, 0 replies; 6+ messages in thread
From: Jason @ 2016-10-12 11:18 UTC (permalink / raw)


Nice find, thanks. Queue 'er up.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] shared: remove unused function strrpart()
  2016-10-10 18:36 ` [PATCH 2/3] shared: remove unused function strrpart() list
@ 2016-10-12 11:18   ` Jason
  0 siblings, 0 replies; 6+ messages in thread
From: Jason @ 2016-10-12 11:18 UTC (permalink / raw)


LGTM.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] shared: remove unused function strlpart()
  2016-10-10 18:36 ` [PATCH 3/3] shared: remove unused function strlpart() list
@ 2016-10-12 11:18   ` Jason
  0 siblings, 0 replies; 6+ messages in thread
From: Jason @ 2016-10-12 11:18 UTC (permalink / raw)


Also looks good.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-12 11:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-10 18:36 [PATCH 1/3] ui-repolist: fix memory leak list
2016-10-10 18:36 ` [PATCH 2/3] shared: remove unused function strrpart() list
2016-10-12 11:18   ` Jason
2016-10-10 18:36 ` [PATCH 3/3] shared: remove unused function strlpart() list
2016-10-12 11:18   ` Jason
2016-10-12 11:18 ` [PATCH 1/3] ui-repolist: fix memory leak Jason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).