Commit ebc6542a26dbc7b2b6e196251745f9dc7a9b9cf6

Tracey Emery 2020-04-14T17:40:42

remove all asprintf from gw_blame_cb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/gotweb/gotweb.c b/gotweb/gotweb.c
index 3bcfcd1..8317195 100644
--- a/gotweb/gotweb.c
+++ b/gotweb/gotweb.c
@@ -3755,12 +3755,9 @@ gw_blame_cb(void *arg, int nlines, int lineno, struct got_object_id *id)
 		if (kerr != KCGI_OK)
 			goto err;
 
-		if (asprintf(&href_diff,
-		    "?path=%s&action=diff&commit=%s",
-		    a->gw_trans->repo_name, bline->id_str) == -1) {
-			err = got_error_from_errno("asprintf");
-			goto err;
-		}
+		href_diff = khttp_urlpart(NULL, NULL, "gotweb", "path",
+		    a->gw_trans->repo_name, "action", "diff", "commit",
+		    bline->id_str, NULL);
 		kerr = khtml_attr(a->gw_trans->gw_html_req, KELEM_A,
 		    KATTR_HREF, href_diff, KATTR__MAX);
 		if (kerr != KCGI_OK)