* [PATCH] diff-lib.c: don't strdup twice
@ 2007-07-07 18:19 René Scharfe
2007-07-07 18:52 ` Johannes Schindelin
0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2007-07-07 18:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, Git Mailing List
The static function read_directory in diff-lib.c is only ever called
with struct path_list lists with .strdup_paths turned on, i.e.
path_list_insert will strdup the paths for us (again). Let's take
advantage of that and stop doing it twice.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
diff-lib.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/diff-lib.c b/diff-lib.c
index 7fb19c7..92c0e39 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -24,7 +24,7 @@ static int read_directory(const char *path, struct path_list *list)
while ((e = readdir(dir)))
if (strcmp(".", e->d_name) && strcmp("..", e->d_name))
- path_list_insert(xstrdup(e->d_name), list);
+ path_list_insert(e->d_name, list);
closedir(dir);
return 0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] diff-lib.c: don't strdup twice
2007-07-07 18:19 [PATCH] diff-lib.c: don't strdup twice René Scharfe
@ 2007-07-07 18:52 ` Johannes Schindelin
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2007-07-07 18:52 UTC (permalink / raw)
To: René Scharfe; +Cc: Junio C Hamano, Git Mailing List
Hi,
On Sat, 7 Jul 2007, Ren? Scharfe wrote:
> The static function read_directory in diff-lib.c is only ever called
> with struct path_list lists with .strdup_paths turned on, i.e.
> path_list_insert will strdup the paths for us (again). Let's take
> advantage of that and stop doing it twice.
Indeed.
Acked-by: Johannes E. Schindelin <johannes.schindelin@gmx.de>
Thanks,
Dscho
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-07 18:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-07 18:19 [PATCH] diff-lib.c: don't strdup twice René Scharfe
2007-07-07 18:52 ` Johannes Schindelin
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).