/*
+--------------------------------------------------------------------+
- | libmemcached - C/C++ Client Library for memcached |
+ | libmemcached-awesome - C/C++ Client Library for memcached |
+--------------------------------------------------------------------+
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted under the terms of the BSD license. |
| the terms online at: https://opensource.org/licenses/BSD-3-Clause |
+--------------------------------------------------------------------+
| Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
- | Copyright (c) 2020 Michael Wallner <mike@php.net> |
+ | Copyright (c) 2020-2021 Michael Wallner https://awesome.co/ |
+--------------------------------------------------------------------+
*/
#include <errno.h>
#include <stdbool.h>
#include <string.h>
-#include <strings.h>
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
#include <ctype.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include "p9y/socket.hpp"
/*
** **********************************************************************
}
/* Do we have pending data to send? */
- while (client->output != NULL) {
+ while (client->output) {
ssize_t len =
client->root->send(client, client->sock, client->output->data + client->output->offset,
client->output->nbytes - client->output->offset);
*/
struct memcached_protocol_st *memcached_protocol_create_instance(void) {
struct memcached_protocol_st *ret = calloc(1, sizeof(*ret));
- if (ret != NULL) {
+ if (ret) {
ret->recv = default_recv;
ret->send = default_send;
ret->drain = drain_output;
struct memcached_protocol_client_st *
memcached_protocol_create_client(struct memcached_protocol_st *instance, memcached_socket_t sock) {
struct memcached_protocol_client_st *ret = calloc(1, sizeof(memcached_protocol_client_st));
- if (ret != NULL) {
+ if (ret) {
ret->root = instance;
ret->sock = sock;
ret->work = determine_protocol;