diff options
author | Jim Meyering <jim@meyering.net> | 1998-01-01 21:32:46 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-01-01 21:32:46 +0000 |
commit | b3d19ee824cc289ccc59a6ad71aeee63652199c3 (patch) | |
tree | 9582238fee50402de448388caa780be0dea18749 /src | |
parent | 2c2fa642c4622b2597eb96e580c9ebb072765ccc (diff) | |
download | coreutils-b3d19ee824cc289ccc59a6ad71aeee63652199c3.tar.xz |
(remove_cwd_entries): Initialize the entry-name obstack
only once and never free it.
Diffstat (limited to 'src')
-rw-r--r-- | src/rm.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -529,11 +529,16 @@ remove_cwd_entries (void) struct HT *ht = NULL; /* FIXME: describe */ - struct obstack entry_name_pool; + static struct obstack entry_name_pool; + static int first_call = 1; enum RM_status status = RM_OK; - obstack_init (&entry_name_pool); + if (first_call) + { + first_call = 0; + obstack_init (&entry_name_pool); + } if (dirp) { @@ -674,7 +679,8 @@ remove_cwd_entries (void) hash_free (ht); } - obstack_free (&entry_name_pool, NULL); + if (obstack_object_size (&entry_name_pool) > 0) + obstack_free (&entry_name_pool, obstack_base (&entry_name_pool)); return status; } |