aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-loop.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-06-21 13:27:42 +0000
committerJason Molenda <jmolenda@apple.com>1999-06-21 13:27:42 +0000
commit9e0b60a847e443d0120ddd61a479e25ae8fcb83d (patch)
treee90e7c759d41943a9c008cc4fd49fc613dc4ce8d /gdb/event-loop.c
parenta8e53fb060baeebbf81fa5c0462effe814dfa1c5 (diff)
downloadgdb-9e0b60a847e443d0120ddd61a479e25ae8fcb83d.zip
gdb-9e0b60a847e443d0120ddd61a479e25ae8fcb83d.tar.gz
gdb-9e0b60a847e443d0120ddd61a479e25ae8fcb83d.tar.bz2
import gdb-1999-06-21 snapshot
Diffstat (limited to 'gdb/event-loop.c')
-rw-r--r--gdb/event-loop.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 77f46bb..fc20df1 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -18,18 +18,16 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include "event-loop.h"
-#include <readline/readline.h>
-#include <setjmp.h>
-#include "top.h"
-
-/* For config.h which may define HAVE_POLL */
#include "defs.h"
-
+#include "top.h"
+#include "event-loop.h"
#ifdef HAVE_POLL
-#include <sys/poll.h>
+#include <poll.h>
+#else
+#include <sys/types.h>
#endif
#include <errno.h>
+#include <setjmp.h>
/* Event queue:
- the first event in the queue is the head of the queue.
@@ -337,9 +335,13 @@ create_file_handler (fd, mask, proc, client_data)
#ifdef HAVE_POLL
gdb_notifier.num_fds++;
- gdb_notifier.poll_fds =
- (struct pollfd *) realloc (gdb_notifier.poll_fds,
- (gdb_notifier.num_fds) * sizeof (struct pollfd));
+ if (gdb_notifier.poll_fds)
+ gdb_notifier.poll_fds =
+ (struct pollfd *) realloc (gdb_notifier.poll_fds,
+ (gdb_notifier.num_fds) * sizeof (struct pollfd));
+ else
+ gdb_notifier.poll_fds =
+ (struct pollfd *) xmalloc (sizeof (struct pollfd));
(gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->fd = fd;
(gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->events = mask;
(gdb_notifier.poll_fds + gdb_notifier.num_fds - 1)->revents = 0;
@@ -463,7 +465,7 @@ delete_file_handler (fd)
else
{
for (prev_ptr = gdb_notifier.first_file_handler;
- prev_ptr->next_file == file_ptr;
+ prev_ptr->next_file != file_ptr;
prev_ptr = prev_ptr->next_file)
;
prev_ptr->next_file = file_ptr->next_file;