#define MEMCACHED_DEFAULT_PORT 11211
#define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
#define MEMCACHED_MAX_BUFFER 8196
-#define MEMCACHED_MAX_HOST_LENGTH 64
#define MEMCACHED_MAX_HOST_SORT_LENGTH 86 /* Used for Ketama */
#define MEMCACHED_POINTS_PER_SERVER 100
#define MEMCACHED_POINTS_PER_SERVER_KETAMA 160
#ifndef __LIBMEMCACHED_MEMCACHED_H__
#define __LIBMEMCACHED_MEMCACHED_H__
-#include <stdlib.h>
#include <inttypes.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
#if !defined(__cplusplus)
# include <stdbool.h>
#endif
-#include <sys/types.h>
-#include <netinet/in.h>
-
#include <libmemcached/visibility.h>
#include <libmemcached/configure.h>
#include <libmemcached/constants.h>
if (hostname == NULL)
self->hostname[0]= 0;
else
- strncpy(self->hostname, hostname, MEMCACHED_MAX_HOST_LENGTH - 1);
+ strncpy(self->hostname, hostname, NI_MAXHOST - 1);
}
static memcached_server_st *_server_create(memcached_server_st *self, const memcached_st *memc)
for (x= 0, host_index= 0; x < memcached_server_count(root); x++)
{
- if (strncmp(list[x].hostname, st_ptr->hostname, MEMCACHED_MAX_HOST_LENGTH) != 0 || list[x].port != st_ptr->port)
+ if (strncmp(list[x].hostname, st_ptr->hostname, NI_MAXHOST) != 0 || list[x].port != st_ptr->port)
{
if (host_index != x)
memcpy(list+host_index, list+x, sizeof(memcached_server_st));
uint64_t limit_maxbytes;
char read_buffer[MEMCACHED_MAX_BUFFER];
char write_buffer[MEMCACHED_MAX_BUFFER];
- char hostname[MEMCACHED_MAX_HOST_LENGTH];
+ char hostname[NI_MAXHOST];
};
clone= hashkit_clone(NULL, hashk);
test_true(hashkit_compare(clone, hashk));
+ hashkit_free(clone);
return TEST_SUCCESS;
}