C++: double underscores are reserved
[awesomized/libmemcached] / src / libmemcached / io.cc
index 8e5d93b7f84b4c5527f5198e120247692821d68c..1cc62e47d942d077f329d400761d5938f37db5c6 100644 (file)
 */
 
 #include "libmemcached/common.h"
-
-#ifdef HAVE_SYS_SOCKET_H
-#  include <sys/socket.h>
-#endif
+#include "p9y/poll.hpp"
 
 void initialize_binary_request(memcached_instance_st *server,
                                protocol_binary_request_header &header) {
@@ -63,7 +60,7 @@ static bool repack_input_buffer(memcached_instance_st *instance) {
           case EWOULDBLOCK:
 #endif
           case EAGAIN:
-#ifdef __linux
+#ifdef HAVE_ERESTART
           case ERESTART:
 #endif
             break; // No IO is fine, we can just move on
@@ -101,7 +98,7 @@ static bool process_input_buffer(memcached_instance_st *instance) {
    ** We might be able to process some of the response messages if we
    ** have a callback set up
    */
-  if (instance->root->callbacks != NULL) {
+  if (instance->root->callbacks) {
     /*
      * We might have responses... try to read them out and fire
      * callbacks
@@ -212,7 +209,7 @@ static memcached_return_t io_wait(memcached_instance_st *instance, const short e
     int local_errno = get_socket_errno(); // We cache in case memcached_quit_server() modifies errno
     assert_msg(active_fd == -1, "poll() returned an unexpected value");
     switch (local_errno) {
-#ifdef __linux
+#ifdef ERESTART
     case ERESTART:
 #endif
     case EINTR:
@@ -370,7 +367,7 @@ static memcached_return_t _io_fill(memcached_instance_st *instance) {
       case EWOULDBLOCK:
 #endif
       case EAGAIN:
-#ifdef __linux
+#ifdef HAVE_ERESTART
       case ERESTART:
 #endif
       {
@@ -499,7 +496,7 @@ memcached_return_t memcached_io_slurp(memcached_instance_st *instance) {
       case EWOULDBLOCK:
 #endif
       case EAGAIN:
-#ifdef __linux
+#ifdef ERESTART
       case ERESTART:
 #endif
         if (memcached_success(io_wait(instance, POLLIN))) {