From 9d5ba9daee2ce18177f00aa4c1c38b33e958b4ea Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 23 Aug 2006 21:17:50 +0000 Subject: [PATCH] Rollback my changes for the Windows port on these 3 files. Remove some of the functionality of libevent for Windows. Anyway, these functions are not currently used in the Open MPI project, so it's safe to remove them from the Windows library. But, they should be never used otherwise changes are required. This commit was SVN r11378. --- opal/event/buffer.c | 20 +++++++------------- opal/event/evbuffer.c | 16 +++++----------- opal/event/log.h | 2 -- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/opal/event/buffer.c b/opal/event/buffer.c index 7e57f829cb..f27e2d5766 100644 --- a/opal/event/buffer.c +++ b/opal/event/buffer.c @@ -62,7 +62,7 @@ evbuffer_new(void) { struct evbuffer *buffer; - buffer = (struct evbuffer*)calloc(1, sizeof(struct evbuffer)); + buffer = calloc(1, sizeof(struct evbuffer)); return (buffer); } @@ -207,7 +207,7 @@ evbuffer_readline(struct evbuffer *buffer) if (i == (u_int) len) return (NULL); - if ((line = (char*)malloc(i + 1)) == NULL) { + if ((line = malloc(i + 1)) == NULL) { fprintf(stderr, "%s: out of memory\n", __func__); evbuffer_drain(buffer, i); return (NULL); @@ -274,7 +274,7 @@ evbuffer_expand(struct evbuffer *buf, size_t datlen) if ((newbuf = realloc(buf->buffer, length)) == NULL) return (-1); - buf->orig_buffer = buf->buffer = (u_char*)newbuf; + buf->orig_buffer = buf->buffer = newbuf; buf->totallen = length; } @@ -336,19 +336,13 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch) { u_char *p; size_t oldoff = buf->off; -#ifdef WIN32 - u_long n = EVBUFFER_MAX_READ; - DWORD dwBytesRead; -#else int n = EVBUFFER_MAX_READ; +#ifdef WIN32 + DWORD dwBytesRead; #endif -#if !defined(__WINDOWS__) && defined(FIONREAD) -#ifdef WIN32 - if (ioctlsocket(fd, FIONREAD, &n) == -1 || n == 0) { -#else +#ifdef FIONREAD if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) { -#endif n = EVBUFFER_MAX_READ; } else if (n > EVBUFFER_MAX_READ && n > howmuch) { /* @@ -432,7 +426,7 @@ evbuffer_find(struct evbuffer *buffer, const u_char *what, size_t len) u_char *search = buffer->buffer; u_char *p; - while ((p = (u_char*)memchr(search, *what, remain)) != NULL && remain >= len) { + while ((p = memchr(search, *what, remain)) != NULL && remain >= len) { if (memcmp(p, what, len) == 0) return (p); diff --git a/opal/event/evbuffer.c b/opal/event/evbuffer.c index 93aa8fcad0..0160e94d0e 100644 --- a/opal/event/evbuffer.c +++ b/opal/event/evbuffer.c @@ -42,7 +42,6 @@ #endif #include "event.h" -#include "opal/opal_socket_errno.h" /* prototypes */ @@ -71,7 +70,7 @@ bufferevent_add(struct opal_event *ev, int timeout) static void bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now, void *arg) { - struct bufferevent *bufev = (struct bufferevent*)arg; + struct bufferevent *bufev = arg; /* * If we are below the watermak then reschedule reading if it's * still enabled. @@ -87,7 +86,7 @@ bufferevent_read_pressure_cb(struct evbuffer *buf, size_t old, size_t now, static void bufferevent_readcb(int fd, short event, void *arg) { - struct bufferevent *bufev = (struct bufferevent*)arg; + struct bufferevent *bufev = arg; int res = 0; short what = OPAL_EVBUFFER_READ; size_t len; @@ -141,7 +140,7 @@ bufferevent_readcb(int fd, short event, void *arg) static void bufferevent_writecb(int fd, short event, void *arg) { - struct bufferevent *bufev = (struct bufferevent*)arg; + struct bufferevent *bufev = arg; int res = 0; short what = OPAL_EVBUFFER_WRITE; @@ -155,12 +154,7 @@ bufferevent_writecb(int fd, short event, void *arg) if (res == -1) { if (errno == EAGAIN || errno == EINTR || -#if !defined(__WINDOWS__) - errno == EINPROGRESS -#else - 0 -#endif /* !defined(__WINDOWS__) */ - ) + errno == EINPROGRESS) goto reschedule; /* error case */ what |= OPAL_EVBUFFER_ERROR; @@ -207,7 +201,7 @@ bufferevent_new(int fd, evbuffercb readcb, evbuffercb writecb, { struct bufferevent *bufev; - if ((bufev = (struct bufferevent*)calloc(1, sizeof(struct bufferevent))) == NULL) + if ((bufev = calloc(1, sizeof(struct bufferevent))) == NULL) return (NULL); if ((bufev->input = evbuffer_new()) == NULL) { diff --git a/opal/event/log.h b/opal/event/log.h index dad2465b7e..e19d8a06ea 100644 --- a/opal/event/log.h +++ b/opal/event/log.h @@ -27,8 +27,6 @@ #ifndef _LOG_H_ #define _LOG_H_ -#include "opal/event/event_rename.h" - void event_err(int eval, const char *fmt, ...); void event_warn(const char *fmt, ...); void event_errx(int eval, const char *fmt, ...);