allocated buffer.
(save_inferior_pid): Restore the PID from that tempoary
buffer. Delete the buffer.
* utils.c (make_cleanup_close, do_close_cleanup): Ditto for FD.
2001-02-06 Andrew Cagney <ac131313@redhat.com>
+ * sol-thread.c (restore_inferior_pid): Save the PID in a freshly
+ allocated buffer.
+ (save_inferior_pid): Restore the PID from that tempoary
+ buffer. Delete the buffer.
+ * utils.c (make_cleanup_close, do_close_cleanup): Ditto for FD.
+
+2001-02-06 Andrew Cagney <ac131313@redhat.com>
+
* MAINTAINERS: Add ``The Obvious Fix Rule''.
2001-02-06 Andrew Cagney <ac131313@redhat.com>
static struct cleanup *
save_inferior_pid (void)
{
- return make_cleanup (restore_inferior_pid, (void *) inferior_pid);
+ int *saved_pid = xmalloc (sizeof (int));
+ *saved_pid = inferior_pid;
+ return make_cleanup (restore_inferior_pid, saved_pid);
}
static void
-restore_inferior_pid (void *pid)
+restore_inferior_pid (void *data)
{
- inferior_pid = (int) pid;
+ int *saved_pid = data;
+ inferior_pid = *saved_pid;
+ xfree (saved_pid);
}
\f
static void
do_close_cleanup (void *arg)
{
- close ((int) arg);
+ int *fd = arg;
+ close (*fd);
+ xfree (fd);
}
struct cleanup *
make_cleanup_close (int fd)
{
- /* int into void*. Outch!! */
- return make_cleanup (do_close_cleanup, (void *) fd);
+ int *saved_fd = xmalloc (sizeof (fd));
+ *saved_fd = fd;
+ return make_cleanup (do_close_cleanup, saved_fd);
}
static void