]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - net.c
Rename mood_switch(), mood_close(), playlist_{open/close}.
[paraslash.git] / net.c
diff --git a/net.c b/net.c
index d1dcba0a26a27472606c48f66d17296faf04fcd7..e01af24be27c49a00a60a61a98448bc3d82046f0 100644 (file)
--- a/net.c
+++ b/net.c
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
-
-/* At least NetBSD needs these. */
-#ifndef AI_V4MAPPED
-#define AI_V4MAPPED 0
-#endif
-#ifndef AI_ALL
-#define AI_ALL 0
-#endif
-#ifndef AI_ADDRCONFIG
-#define AI_ADDRCONFIG 0
-#endif
-
 #include <regex.h>
 
 #include "error.h"
@@ -298,9 +286,9 @@ struct flowopts {
  */
 struct flowopts *flowopt_new(void)
 {
-       struct flowopts *new = para_malloc(sizeof(*new));
+       struct flowopts *new = alloc(sizeof(*new));
 
-       INIT_LIST_HEAD(&new->sockopts);
+       init_list_head(&new->sockopts);
        return new;
 }
 
@@ -319,7 +307,7 @@ struct flowopts *flowopt_new(void)
 void flowopt_add(struct flowopts *fo, int lev, int opt,
                const char *name, const void *val, int len)
 {
-       struct pre_conn_opt *new = para_malloc(sizeof(*new));
+       struct pre_conn_opt *new = alloc(sizeof(*new));
 
        new->sock_option = opt;
        new->sock_level  = lev;
@@ -329,7 +317,7 @@ void flowopt_add(struct flowopts *fo, int lev, int opt,
                new->opt_val = NULL;
                new->opt_len = 0;
        } else {
-               new->opt_val = para_malloc(len);
+               new->opt_val = alloc(len);
                new->opt_len = len;
                memcpy(new->opt_val, val, len);
        }
@@ -813,25 +801,21 @@ int recv_buffer(int fd, char *buf, size_t size)
  * Wrapper around the accept system call.
  *
  * \param fd The listening socket.
- * \param rfds An optional fd_set pointer.
  * \param addr Structure which is filled in with the address of the peer socket.
  * \param size Should contain the size of the structure pointed to by \a addr.
  * \param new_fd Result pointer.
  *
- * Accept incoming connections on \a addr, retry if interrupted. If \a rfds is
- * not \p NULL, return 0 if \a fd is not set in \a rfds without calling accept().
+ * Accept incoming connections on addr, retry if interrupted.
  *
  * \return Negative on errors, zero if no connections are present to be accepted,
  * one otherwise.
  *
  * \sa accept(2).
  */
-int para_accept(int fd, fd_set *rfds, void *addr, socklen_t size, int *new_fd)
+int para_accept(int fd, void *addr, socklen_t size, int *new_fd)
 {
        int ret;
 
-       if (rfds && !FD_ISSET(fd, rfds))
-               return 0;
        do
                ret = accept(fd, (struct sockaddr *) addr, &size);
        while (ret < 0 && errno == EINTR);