2017-05-08 Florian Weimer <fweimer@redhat.com>
+ Delete temporary files in LIFO order.
+ * support/temp_file.c (struct temp_name_list): Replace q member
+ with next.
+ (add_temp_file): Add new file to front of linked list.
+ (support_delete_temp_files): Use next member.
+ (support_print_temp_files): Likewise.
+
+2017-05-08 Florian Weimer <fweimer@redhat.com>
+
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Remove
sys/ultrasound.h.
* sysdeps/unix/sysv/linux/sys/ultrasound.h: Remove file.
#include <support/support.h>
#include <paths.h>
-#include <search.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* List of temporary files. */
static struct temp_name_list
{
- struct qelem q;
+ struct temp_name_list *next;
char *name;
} *temp_name_list;
if (newname != NULL)
{
newp->name = newname;
- if (temp_name_list == NULL)
- temp_name_list = (struct temp_name_list *) &newp->q;
- else
- insque (newp, temp_name_list);
+ newp->next = temp_name_list;
+ temp_name_list = newp;
}
else
free (newp);
(void) remove (temp_name_list->name);
free (temp_name_list->name);
- struct temp_name_list *next
- = (struct temp_name_list *) temp_name_list->q.q_forw;
+ struct temp_name_list *next = temp_name_list->next;
free (temp_name_list);
temp_name_list = next;
}
{
struct temp_name_list *n;
fprintf (f, "temp_files=(\n");
- for (n = temp_name_list;
- n != NULL;
- n = (struct temp_name_list *) n->q.q_forw)
+ for (n = temp_name_list; n != NULL; n = n->next)
fprintf (f, " '%s'\n", n->name);
fprintf (f, ")\n");
}