From: Trond Norbye Date: Tue, 30 Sep 2008 07:51:11 +0000 (+0200) Subject: Hostname (and filename) should be const in memcached_server_add* X-Git-Tag: 0.25~19 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=8386963414b7c9d9fa5328ab1d4dd768d742ad54;p=m6w6%2Flibmemcached Hostname (and filename) should be const in memcached_server_add* --- diff --git a/docs/memcached_server_st.pod b/docs/memcached_server_st.pod index 0359bf9d..45a55bef 100755 --- a/docs/memcached_server_st.pod +++ b/docs/memcached_server_st.pod @@ -15,7 +15,7 @@ C Client Library for memcached (libmemcached, -lmemcached) memcached_server_st * memcached_server_list_append (memcached_server_st *ptr, - char *hostname, + const char *hostname, unsigned int port, memcached_return *error); diff --git a/docs/memcached_servers.pod b/docs/memcached_servers.pod index d1a61cd6..0e26e37d 100755 --- a/docs/memcached_servers.pod +++ b/docs/memcached_servers.pod @@ -17,12 +17,12 @@ C Client Library for memcached (libmemcached, -lmemcached) memcached_return memcached_server_add (memcached_st *ptr, - char *hostname, + const char *hostname, unsigned int port); memcached_return memcached_server_add_unix_socket (memcached_st *ptr, - char *socket); + const char *socket); memcached_return memcached_server_push (memcached_st *ptr, diff --git a/libmemcached/common.h b/libmemcached/common.h index 24d4cce8..b64af723 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -125,7 +125,7 @@ extern uint64_t ntohll(uint64_t); extern uint64_t htonll(uint64_t); void host_reset(memcached_st *ptr, memcached_server_st *host, - char *hostname, unsigned int port, + const char *hostname, unsigned int port, memcached_connection type); #endif /* __COMMON_H__ */ diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index f0b06948..a7565e1c 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -132,17 +132,17 @@ uint64_t memcached_behavior_get(memcached_st *ptr, memcached_behavior flag); /* Server Public functions */ memcached_return memcached_server_add_udp(memcached_st *ptr, - char *hostname, + const char *hostname, unsigned int port); memcached_return memcached_server_add_unix_socket(memcached_st *ptr, - char *filename); -memcached_return memcached_server_add(memcached_st *ptr, char *hostname, + const char *filename); +memcached_return memcached_server_add(memcached_st *ptr, const char *hostname, unsigned int port); void memcached_server_list_free(memcached_server_st *ptr); memcached_return memcached_server_push(memcached_st *ptr, memcached_server_st *list); memcached_server_st *memcached_server_list_append(memcached_server_st *ptr, - char *hostname, unsigned int port, + const char *hostname, unsigned int port, memcached_return *error); unsigned int memcached_server_list_count(memcached_server_st *ptr); memcached_server_st *memcached_servers_parse(char *server_strings); diff --git a/libmemcached/memcached_hosts.c b/libmemcached/memcached_hosts.c index 3082f693..f7a7dfcf 100644 --- a/libmemcached/memcached_hosts.c +++ b/libmemcached/memcached_hosts.c @@ -2,7 +2,7 @@ #include /* Protoypes (static) */ -static memcached_return server_add(memcached_st *ptr, char *hostname, +static memcached_return server_add(memcached_st *ptr, const char *hostname, unsigned int port, memcached_connection type); memcached_return update_continuum(memcached_st *ptr); @@ -52,7 +52,7 @@ memcached_return run_distribution(memcached_st *ptr) } void host_reset(memcached_st *ptr, memcached_server_st *host, - char *hostname, unsigned int port, + const char *hostname, unsigned int port, memcached_connection type) { memset(host, 0, sizeof(memcached_server_st)); @@ -232,7 +232,7 @@ memcached_return memcached_server_push(memcached_st *ptr, memcached_server_st *l return run_distribution(ptr); } -memcached_return memcached_server_add_unix_socket(memcached_st *ptr, char *filename) +memcached_return memcached_server_add_unix_socket(memcached_st *ptr, const char *filename) { if (!filename) return MEMCACHED_FAILURE; @@ -241,7 +241,7 @@ memcached_return memcached_server_add_unix_socket(memcached_st *ptr, char *filen } memcached_return memcached_server_add_udp(memcached_st *ptr, - char *hostname, + const char *hostname, unsigned int port) { if (!port) @@ -254,7 +254,7 @@ memcached_return memcached_server_add_udp(memcached_st *ptr, } memcached_return memcached_server_add(memcached_st *ptr, - char *hostname, + const char *hostname, unsigned int port) { if (!port) @@ -266,7 +266,7 @@ memcached_return memcached_server_add(memcached_st *ptr, return server_add(ptr, hostname, port, MEMCACHED_CONNECTION_TCP); } -static memcached_return server_add(memcached_st *ptr, char *hostname, +static memcached_return server_add(memcached_st *ptr, const char *hostname, unsigned int port, memcached_connection type) { @@ -317,7 +317,7 @@ memcached_return memcached_server_remove(memcached_server_st *st_ptr) } memcached_server_st *memcached_server_list_append(memcached_server_st *ptr, - char *hostname, unsigned int port, + const char *hostname, unsigned int port, memcached_return *error) { unsigned int count;