mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
* src/remove.c (AD_ensure_initialized): New function.
after statement. Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
This commit is contained in:
1 parent
1b95d5ee81
commit
1ce71652fc
2 files changed
+16
-6
No files matched your search
@@ -6,6 +6,9 @@
|
||||
Update the caller in remove_dir.
|
||||
(AD_pop_and_chdir): Return prev_dir rather than storing through
|
||||
a pointer argument. All uses changed.
|
||||
(AD_ensure_initialized): New function.
|
||||
(AD_mark_helper): Use it, to avoid the need for declaration
|
||||
after statement.
|
||||
|
||||
2006-11-25 Jim Meyering <jim@meyering.net>
|
||||
|
||||
|
||||
+13
-6
@@ -540,10 +540,9 @@ AD_pop_and_chdir (DIR **dirp, Dirstack_state *ds)
|
||||
return prev_dir;
|
||||
}
|
||||
|
||||
/* Initialize *HT if it is NULL.
|
||||
Insert FILENAME into HT. */
|
||||
static void
|
||||
AD_mark_helper (Hash_table **ht, char *filename)
|
||||
/* Initialize *HT if it is NULL. Return *HT. */
|
||||
static Hash_table *
|
||||
AD_ensure_initialized (Hash_table **ht)
|
||||
{
|
||||
if (*ht == NULL)
|
||||
{
|
||||
@@ -552,7 +551,16 @@ AD_mark_helper (Hash_table **ht, char *filename)
|
||||
if (*ht == NULL)
|
||||
xalloc_die ();
|
||||
}
|
||||
void *ent = hash_insert (*ht, filename);
|
||||
|
||||
return *ht;
|
||||
}
|
||||
|
||||
/* Initialize *HT if it is NULL.
|
||||
Insert FILENAME into HT. */
|
||||
static void
|
||||
AD_mark_helper (Hash_table **ht, char *filename)
|
||||
{
|
||||
void *ent = hash_insert (AD_ensure_initialized (ht), filename);
|
||||
if (ent == NULL)
|
||||
xalloc_die ();
|
||||
else
|
||||
@@ -560,7 +568,6 @@ AD_mark_helper (Hash_table **ht, char *filename)
|
||||
if (ent != filename)
|
||||
free (filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Mark FILENAME (in current directory) as unremovable. */
|
||||
|
||||
Reference in new issue
Block a user