@@ -1276,15 +1276,14 @@ static int update(int argc, const char **argv)
1276
1276
static int get_one_entry (struct remote * remote , void * priv )
1277
1277
{
1278
1278
struct string_list * list = priv ;
1279
+ struct strbuf url_buf = STRBUF_INIT ;
1279
1280
const char * * url ;
1280
1281
int i , url_nr ;
1281
- void * * utilp ;
1282
1282
1283
1283
if (remote -> url_nr > 0 ) {
1284
- utilp = & (string_list_append (remote -> name , list )-> util );
1285
- * utilp = xmalloc (strlen (remote -> url [0 ])+ strlen (" (fetch)" )+ 1 );
1286
- strcpy ((char * ) * utilp , remote -> url [0 ]);
1287
- strcat ((char * ) * utilp , " (fetch)" );
1284
+ strbuf_addf (& url_buf , "%s (fetch)" , remote -> url [0 ]);
1285
+ string_list_append (remote -> name , list )-> util =
1286
+ strbuf_detach (& url_buf , NULL );
1288
1287
} else
1289
1288
string_list_append (remote -> name , list )-> util = NULL ;
1290
1289
if (remote -> pushurl_nr ) {
@@ -1296,10 +1295,9 @@ static int get_one_entry(struct remote *remote, void *priv)
1296
1295
}
1297
1296
for (i = 0 ; i < url_nr ; i ++ )
1298
1297
{
1299
- utilp = & (string_list_append (remote -> name , list )-> util );
1300
- * utilp = xmalloc (strlen (url [i ])+ strlen (" (push)" )+ 1 );
1301
- strcpy ((char * ) * utilp , url [i ]);
1302
- strcat ((char * ) * utilp , " (push)" );
1298
+ strbuf_addf (& url_buf , "%s (push)" , url [i ]);
1299
+ string_list_append (remote -> name , list )-> util =
1300
+ strbuf_detach (& url_buf , NULL );
1303
1301
}
1304
1302
1305
1303
return 0 ;
0 commit comments