From: Brian Aker Date: Tue, 24 May 2011 21:46:52 +0000 (-0700) Subject: Merge in bug fix for lp:779837 X-Git-Tag: 0.51~9^2 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=f0cc25810bfd089de866bd0d1e35c3157e86a930;p=m6w6%2Flibmemcached Merge in bug fix for lp:779837 --- diff --git a/libmemcached/analyze.h b/libmemcached/analyze.h index 4a8128bd..955901a2 100644 --- a/libmemcached/analyze.h +++ b/libmemcached/analyze.h @@ -1,16 +1,41 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Generate a memcached_analysis_st + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_ANALYZE_H__ -#define __LIBMEMCACHED_ANALYZE_H__ +#pragma once struct memcached_analysis_st { memcached_st *root; @@ -39,5 +64,3 @@ void memcached_analyze_free(memcached_analysis_st *); #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_ANALYZE_H__ */ diff --git a/libmemcached/behavior.h b/libmemcached/behavior.h index ca6fb492..426f9889 100644 --- a/libmemcached/behavior.h +++ b/libmemcached/behavior.h @@ -1,16 +1,41 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Change the behavior of the memcached connection. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_BEHAVIOR_H__ -#define __LIBMEMCACHED_BEHAVIOR_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -43,10 +68,10 @@ memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr); LIBMEMCACHED_LOCAL bool _is_auto_eject_host(const memcached_st *ptr); -LIBMEMCACHED_LOCAL +LIBMEMCACHED_API const char *libmemcached_string_behavior(const memcached_behavior_t flag); -LIBMEMCACHED_LOCAL +LIBMEMCACHED_API const char *libmemcached_string_distribution(const memcached_server_distribution_t flag); LIBMEMCACHED_API @@ -59,5 +84,3 @@ LIBMEMCACHED_API #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_BEHAVIOR_H__ */ diff --git a/libmemcached/callback.h b/libmemcached/callback.h index b4da8080..816e966b 100644 --- a/libmemcached/callback.h +++ b/libmemcached/callback.h @@ -1,17 +1,41 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Change any of the possible callbacks. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #pragma once -#ifndef __LIBMEMCACHED_CALLBACK_H__ -#define __LIBMEMCACHED_CALLBACK_H__ struct memcached_callback_st { memcached_execute_fn *callback; @@ -35,5 +59,3 @@ void *memcached_callback_get(memcached_st *ptr, #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_CALLBACK_H__ */ diff --git a/libmemcached/common.h b/libmemcached/common.h index b8deac8e..40f45111 100644 --- a/libmemcached/common.h +++ b/libmemcached/common.h @@ -91,7 +91,7 @@ memcached_return_t memcached_server_execute(memcached_st *ptr, #include #include #include -#include +#include #include #include #include diff --git a/libmemcached/configure.h.in b/libmemcached/configure.h.in index c45cc803..7b48be2a 100644 --- a/libmemcached/configure.h.in +++ b/libmemcached/configure.h.in @@ -1,16 +1,41 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker, Trond Norbye - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker, Trond Norbye All rights reserved. * - * Summary: Change the behavior of the memcached connection. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_CONFIGURE_H -#define __LIBMEMCACHED_CONFIGURE_H +#pragma once #ifdef __cplusplus extern "C" { @@ -25,5 +50,3 @@ extern "C" { #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_CONFIGURE_H */ diff --git a/libmemcached/constants.h b/libmemcached/constants.h index 3fe44739..976a31d8 100644 --- a/libmemcached/constants.h +++ b/libmemcached/constants.h @@ -1,17 +1,42 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Constants for libmemcached + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + #pragma once -#ifndef __LIBMEMCACHED_CONSTANTS_H__ -#define __LIBMEMCACHED_CONSTANTS_H__ /* Public defines */ #define MEMCACHED_DEFAULT_PORT 11211 @@ -45,7 +70,7 @@ enum memcached_server_distribution_t { typedef enum memcached_server_distribution_t memcached_server_distribution_t; #endif -typedef enum { +enum memcached_behavior_t { MEMCACHED_BEHAVIOR_NO_BLOCK, MEMCACHED_BEHAVIOR_TCP_NODELAY, MEMCACHED_BEHAVIOR_HASH, @@ -83,9 +108,13 @@ typedef enum { MEMCACHED_BEHAVIOR_LOAD_FROM_FILE, MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS, MEMCACHED_BEHAVIOR_MAX -} memcached_behavior_t; +}; -typedef enum { +#ifndef __cplusplus +typedef enum memcached_behavior_t memcached_behavior_t; +#endif + +enum memcached_callback_t { MEMCACHED_CALLBACK_PREFIX_KEY = 0, MEMCACHED_CALLBACK_USER_DATA = 1, MEMCACHED_CALLBACK_CLEANUP_FUNCTION = 2, @@ -98,9 +127,13 @@ typedef enum { MEMCACHED_CALLBACK_GET_FAILURE = 7, MEMCACHED_CALLBACK_DELETE_TRIGGER = 8, MEMCACHED_CALLBACK_MAX -} memcached_callback_t; +}; -typedef enum { +#ifndef __cplusplus +typedef enum memcached_callback_t memcached_callback_t; +#endif + +enum memcached_hash_t { MEMCACHED_HASH_DEFAULT= 0, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, @@ -113,14 +146,20 @@ typedef enum { MEMCACHED_HASH_JENKINS, MEMCACHED_HASH_CUSTOM, MEMCACHED_HASH_MAX -} memcached_hash_t; +}; + +#ifndef __cplusplus +typedef enum memcached_hash_t memcached_hash_t; +#endif -typedef enum { +enum memcached_connection_t { MEMCACHED_CONNECTION_UNKNOWN, MEMCACHED_CONNECTION_TCP, MEMCACHED_CONNECTION_UDP, MEMCACHED_CONNECTION_UNIX_SOCKET, MEMCACHED_CONNECTION_MAX -} memcached_connection_t; +}; -#endif /* __LIBMEMCACHED_CONSTANTS_H__ */ +#ifndef __cplusplus +typedef enum memcached_connection_t memcached_connection_t; +#endif diff --git a/libmemcached/do.h b/libmemcached/do.h deleted file mode 100644 index 2506ddf2..00000000 --- a/libmemcached/do.h +++ /dev/null @@ -1,34 +0,0 @@ -/* LibMemcached - * Copyright (C) 2006-2010 Brian Aker - * All rights reserved. - * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. - * - * Summary: Internal functions used by the library. Not for public use! - * - */ - -#ifndef __LIBMEMCACHED_DO_H__ -#define __LIBMEMCACHED_DO_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -LIBMEMCACHED_LOCAL -memcached_return_t memcached_do(memcached_server_write_instance_st ptr, - const void *commmand, - size_t command_length, - bool with_flush); - -LIBMEMCACHED_LOCAL -memcached_return_t memcached_vdo(memcached_server_write_instance_st ptr, - const struct libmemcached_io_vector_st *vector, size_t count, - bool with_flush); - -#ifdef __cplusplus -} -#endif - -#endif /* __LIBMEMCACHED_DO_H__ */ diff --git a/libmemcached/do.hpp b/libmemcached/do.hpp new file mode 100644 index 00000000..f1232662 --- /dev/null +++ b/libmemcached/do.hpp @@ -0,0 +1,49 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library + * + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#pragma once + +LIBMEMCACHED_LOCAL +memcached_return_t memcached_do(memcached_server_write_instance_st ptr, + const void *commmand, + size_t command_length, + bool with_flush); + +LIBMEMCACHED_LOCAL +memcached_return_t memcached_vdo(memcached_server_write_instance_st ptr, + const struct libmemcached_io_vector_st *vector, size_t count, + bool with_flush); diff --git a/libmemcached/dump.h b/libmemcached/dump.h index 6fcdb257..b6e639e8 100644 --- a/libmemcached/dump.h +++ b/libmemcached/dump.h @@ -1,16 +1,42 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Simple method for dumping data from Memcached. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_DUMP_H__ -#define __LIBMEMCACHED_DUMP_H__ +#pragma once + #ifdef __cplusplus extern "C" { @@ -23,5 +49,3 @@ memcached_return_t memcached_dump(memcached_st *ptr, memcached_dump_fn *function #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_DUMP_H__ */ diff --git a/libmemcached/fetch.h b/libmemcached/fetch.h index 353cca5e..bff186ac 100644 --- a/libmemcached/fetch.h +++ b/libmemcached/fetch.h @@ -1,16 +1,42 @@ -/* LibMemcached - * Copyright (C) 2010 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2010 Brian Aker All rights reserved. * - * Summary: Work with fetching results + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_FETCH_H__ -#define __LIBMEMCACHED_FETCH_H__ +#pragma once + #ifdef __cplusplus extern "C" { @@ -25,5 +51,3 @@ memcached_return_t memcached_fetch_execute(memcached_st *ptr, #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_FETCH_H__ */ diff --git a/libmemcached/get.h b/libmemcached/get.h index 61e34356..32e4c5f3 100644 --- a/libmemcached/get.h +++ b/libmemcached/get.h @@ -1,16 +1,42 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2010 Brian Aker All rights reserved. * - * Summary: Get functions for libmemcached + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_GET_H__ -#define __LIBMEMCACHED_GET_H__ +#pragma once + #ifdef __cplusplus extern "C" { @@ -82,5 +108,3 @@ memcached_return_t memcached_mget_execute_by_key(memcached_st *ptr, #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_GET_H__ */ diff --git a/libmemcached/hash.h b/libmemcached/hash.h index f36ad286..6002a80e 100644 --- a/libmemcached/hash.h +++ b/libmemcached/hash.h @@ -35,8 +35,7 @@ * */ -#ifndef __MEMCACHED_HASH_H__ -#define __MEMCACHED_HASH_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -67,5 +66,3 @@ LIBMEMCACHED_API #ifdef __cplusplus } #endif - -#endif /* __MEMCACHED_HASH_H__ */ diff --git a/libmemcached/include.am b/libmemcached/include.am index 5c0e6638..bd07da6d 100644 --- a/libmemcached/include.am +++ b/libmemcached/include.am @@ -14,7 +14,7 @@ EXTRA_DIST+= \ noinst_HEADERS+= \ libmemcached/byteorder.h \ libmemcached/common.h \ - libmemcached/do.h \ + libmemcached/do.hpp \ libmemcached/error.hpp \ libmemcached/initialize_query.h \ libmemcached/internal.h \ diff --git a/libmemcached/libmemcached_probes.h b/libmemcached/libmemcached_probes.h index 70d69f3d..e9a649d1 100644 --- a/libmemcached/libmemcached_probes.h +++ b/libmemcached/libmemcached_probes.h @@ -1,22 +1,49 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#pragma once + + /* * This file contains the definition of the various probes supported by * libmemcached. Currently it only support DTRACE, but just create an * implementation of the following macros to create your own sort of * probing :) */ -#ifndef __LIBMEMCACHED_PROBES_H__ -#define __LIBMEMCACHED_PROBES_H__ #ifdef HAVE_DTRACE /* @@ -85,5 +112,3 @@ #define LIBMEMCACHED_MEMCACHED_SET_START_ENABLED() (0) #endif - -#endif /* __LIBMEMCACHED_PROBES_H__ */ diff --git a/libmemcached/memcached_util.h b/libmemcached/memcached_util.h index 427d7843..5be5ac95 100644 --- a/libmemcached/memcached_util.h +++ b/libmemcached/memcached_util.h @@ -1,22 +1,43 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Connection pool library. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: * - * Author: Trond Norbye, Brian Aker + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#pragma once -#ifndef __LIBMEMCACHED__MEMCACHED_UTIL_H__ -#define __LIBMEMCACHED__MEMCACHED_UTIL_H__ #include #include #include - -#endif /* __LIBMEMCACHED__MEMCACHED_UTIL_H__ */ diff --git a/libmemcached/platform.h b/libmemcached/platform.h index e7511cad..19248283 100644 --- a/libmemcached/platform.h +++ b/libmemcached/platform.h @@ -1,15 +1,42 @@ -/* LibMemcached - * Copyright (C) 2006-2010 Brian Aker, Trond Norbye - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker, Trond Norbye All rights reserved. * - * Summary: Try to hide platform-specific stuff + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef LIBMEMCACHED_PLATFORM_H -#define LIBMEMCACHED_PLATFORM_H 1 + +#pragma once + #ifdef WIN32 @@ -27,6 +54,3 @@ typedef int memcached_socket_t; #include #endif /* WIN32 */ - - -#endif /* LIBMEMCACHED_PLATFORM_H */ diff --git a/libmemcached/protocol_handler.h b/libmemcached/protocol_handler.h index 9f61187f..1eee5ca5 100644 --- a/libmemcached/protocol_handler.h +++ b/libmemcached/protocol_handler.h @@ -11,8 +11,7 @@ * */ -#ifndef __LIBMEMCACHED_PROTOCOL_H__ -#define __LIBMEMCACHED_PROTOCOL_H__ +#pragma once #include #if !defined(__cplusplus) @@ -214,5 +213,3 @@ memcached_binary_protocol_raw_response_handler memcached_binary_protocol_get_raw #ifdef __cplusplus } #endif - -#endif diff --git a/libmemcached/result.h b/libmemcached/result.h index 5947cb85..6142ba82 100644 --- a/libmemcached/result.h +++ b/libmemcached/result.h @@ -36,8 +36,6 @@ */ #pragma once -#ifndef __LIBMEMCACHED_RESULT_H__ -#define __LIBMEMCACHED_RESULT_H__ struct memcached_result_st { uint32_t item_flags; @@ -99,6 +97,3 @@ void memcached_result_set_expiration(memcached_result_st *self, time_t expiratio #ifdef __cplusplus } // extern "C" #endif - - -#endif /* __LIBMEMCACHED_RESULT_H__ */ diff --git a/libmemcached/sasl.h b/libmemcached/sasl.h index 1105cd81..5a0236bf 100644 --- a/libmemcached/sasl.h +++ b/libmemcached/sasl.h @@ -1,16 +1,41 @@ -/* LibMemcached - * Copyright (C) 2006-2010 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: interface for memcached server - * Description: main include file for libmemcached + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef LIBMEMCACHED_MEMCACHED_SASL_H -#define LIBMEMCACHED_MEMCACHED_SASL_H + +#pragma once #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT #include @@ -59,7 +84,3 @@ struct memcached_sasl_st { */ bool is_allocated; }; - - - -#endif /* LIBMEMCACHED_MEMCACHED_SASL_H */ diff --git a/libmemcached/server_list.h b/libmemcached/server_list.h index 299b491f..8fe6dc7d 100644 --- a/libmemcached/server_list.h +++ b/libmemcached/server_list.h @@ -1,16 +1,42 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Types for libmemcached + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_SERVER_LIST_H__ -#define __LIBMEMCACHED_SERVER_LIST_H__ +#pragma once + #ifdef __cplusplus extern "C" { @@ -49,5 +75,3 @@ LIBMEMCACHED_LOCAL #ifdef __cplusplus } // extern "C" #endif - -#endif /* __LIBMEMCACHED_SERVER_LIST_H__ */ diff --git a/libmemcached/stats.h b/libmemcached/stats.h index a3040306..6742a2f3 100644 --- a/libmemcached/stats.h +++ b/libmemcached/stats.h @@ -1,16 +1,42 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Collect up the stats for a memcached server. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_STATS_H__ -#define __LIBMEMCACHED_STATS_H__ +#pragma once + struct memcached_stat_st { uint32_t connection_structures; @@ -68,5 +94,3 @@ memcached_return_t memcached_stat_execute(memcached_st *memc, const char *args, #ifdef __cplusplus } // extern "C" #endif - -#endif /* __LIBMEMCACHED_STATS_H__ */ diff --git a/libmemcached/storage.h b/libmemcached/storage.h index 48e544c0..0854f164 100644 --- a/libmemcached/storage.h +++ b/libmemcached/storage.h @@ -1,16 +1,41 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Storage related functions, aka set, replace,.. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_STORAGE_H__ -#define __LIBMEMCACHED_STORAGE_H__ +#pragma once #include "libmemcached/memcached.h" @@ -106,5 +131,3 @@ memcached_return_t memcached_cas_by_key(memcached_st *ptr, #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_STORAGE_H__ */ diff --git a/libmemcached/strerror.cc b/libmemcached/strerror.cc index 2e1a01e6..48a970aa 100644 --- a/libmemcached/strerror.cc +++ b/libmemcached/strerror.cc @@ -133,9 +133,8 @@ const char *memcached_strerror(memcached_st *, memcached_return_t rc) return "USER INITIATED ERROR OCCURED WHILE PARSING"; case MEMCACHED_DEPRECATED: return "DEPRECATED"; - case MEMCACHED_MAXIMUM_RETURN: - return "Gibberish returned!"; default: - return "Gibberish returned!"; + case MEMCACHED_MAXIMUM_RETURN: + return "INVALID memcached_return_t"; } } diff --git a/libmemcached/types.h b/libmemcached/types.h index 4317af3b..3a4ae3bd 100644 --- a/libmemcached/types.h +++ b/libmemcached/types.h @@ -37,8 +37,6 @@ #pragma once -#ifndef __LIBMEMCACHED_TYPES_H__ -#define __LIBMEMCACHED_TYPES_H__ typedef struct memcached_st memcached_st; typedef struct memcached_stat_st memcached_stat_st; @@ -117,5 +115,3 @@ typedef memcached_server_fn memcached_server_function; typedef memcached_trigger_key_fn memcached_trigger_key; typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key; typedef memcached_dump_fn memcached_dump_func; - -#endif /* __LIBMEMCACHED_TYPES_H__ */ diff --git a/libmemcached/util.h b/libmemcached/util.h index 5e1d4f3c..d771d241 100644 --- a/libmemcached/util.h +++ b/libmemcached/util.h @@ -1,20 +1,40 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Connection pool library. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: * - * Author: Trond Norbye, Brian Aker + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - -#ifndef __LIBMEMCACHED__UTIL_H__ -#define __LIBMEMCACHED__UTIL_H__ +#pragma once #include - -#endif /* __LIBMEMCACHED__UTIL_H__ */ diff --git a/libmemcached/util/ping.h b/libmemcached/util/ping.h index 095ee00e..e9f3bc50 100644 --- a/libmemcached/util/ping.h +++ b/libmemcached/util/ping.h @@ -1,16 +1,41 @@ -/* LibMemcached - * Copyright (C) 2010 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2010 Brian Aker All rights reserved. * - * Summary: connects to a host, and makes sure it is alive. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_PING_H__ -#define __LIBMEMCACHED_PING_H__ +#pragma once #ifdef __cplusplus extern "C" { @@ -22,5 +47,3 @@ bool libmemcached_util_ping(const char *hostname, in_port_t port, memcached_retu #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED_PING_H__ */ diff --git a/libmemcached/util/pool.h b/libmemcached/util/pool.h index f00966aa..e4a6ce59 100644 --- a/libmemcached/util/pool.h +++ b/libmemcached/util/pool.h @@ -1,17 +1,42 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Connection pool implementation for libmemcached. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#pragma once -#ifndef __LIMEMCACHED_UTIL_POOL_H__ -#define __LIMEMCACHED_UTIL_POOL_H__ #include @@ -51,5 +76,3 @@ memcached_return_t memcached_pool_behavior_get(memcached_pool_st *ptr, #ifdef __cplusplus } // extern "C" #endif - -#endif /* __LIMEMCACHED_UTIL_POOL_H__ */ diff --git a/libmemcached/util/version.h b/libmemcached/util/version.h index 57be9b85..372283a0 100644 --- a/libmemcached/util/version.h +++ b/libmemcached/util/version.h @@ -1,16 +1,42 @@ -/* LibMemcached - * Copyright (C) 2010 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2010 Brian Aker All rights reserved. * - * Summary: connect to all hosts, and make sure they meet a minimum version + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_UTIL_VERSION_H__ -#define __LIBMEMCACHED_UTIL_VERSION_H__ +#pragma once + #ifdef __cplusplus extern "C" { @@ -25,5 +51,3 @@ LIBMEMCACHED_API #ifdef __cplusplus } #endif - -#endif /* __LIBMEMCACHED__UTIL_VERSION_H__ */ diff --git a/libmemcached/watchpoint.h b/libmemcached/watchpoint.h index 341f4fe2..b4fa50e6 100644 --- a/libmemcached/watchpoint.h +++ b/libmemcached/watchpoint.h @@ -1,16 +1,41 @@ -/* LibMemcached - * Copyright (C) 2006-2009 Brian Aker - * All rights reserved. +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Libmemcached library * - * Use and distribution licensed under the BSD license. See - * the COPYING file in the parent directory for full text. + * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2006-2009 Brian Aker All rights reserved. * - * Summary: Localized copy of WATCHPOINT debug symbols + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -#ifndef __LIBMEMCACHED_WATCHPOINT_H__ -#define __LIBMEMCACHED_WATCHPOINT_H__ +#pragma once /* Some personal debugging functions */ #if defined(DEBUG) @@ -83,5 +108,3 @@ static inline void libmemcached_stack_dump(void) #define WATCHPOINT_SET(A) #endif /* DEBUG */ - -#endif /* __LIBMEMCACHED_WATCHPOINT_H__ */ diff --git a/tests/mem_functions.cc b/tests/mem_functions.cc index 10f3291a..712c13d9 100644 --- a/tests/mem_functions.cc +++ b/tests/mem_functions.cc @@ -398,6 +398,28 @@ static test_return_t connection_test(memcached_st *memc) return TEST_SUCCESS; } +static test_return_t libmemcached_string_behavior_test(memcached_st *) +{ + for (int x= MEMCACHED_BEHAVIOR_NO_BLOCK; x < int(MEMCACHED_BEHAVIOR_MAX); ++x) + { + test_true(libmemcached_string_behavior(memcached_behavior_t(x))); + } + test_compare(36, MEMCACHED_BEHAVIOR_MAX); + + return TEST_SUCCESS; +} + +static test_return_t libmemcached_string_distribution_test(memcached_st *) +{ + for (int x= MEMCACHED_DISTRIBUTION_MODULA; x < int(MEMCACHED_DISTRIBUTION_CONSISTENT_MAX); ++x) + { + test_true(libmemcached_string_distribution(memcached_server_distribution_t(x))); + } + test_compare(7, MEMCACHED_DISTRIBUTION_CONSISTENT_MAX); + + return TEST_SUCCESS; +} + static test_return_t error_test(memcached_st *memc) { uint32_t values[] = { 851992627U, 2337886783U, 646418395U, 4001849190U, @@ -2113,7 +2135,7 @@ static test_return_t fetch_all_results(memcached_st *memc, size_t *keys_returned *keys_returned= *keys_returned +1; } - test_true_got(rc == MEMCACHED_END || rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); + test_true_got(rc == MEMCACHED_END || memcached_success(rc), memcached_strerror(NULL, rc)); return TEST_SUCCESS; } @@ -3397,7 +3419,7 @@ static test_return_t mget_read(memcached_st *memc) memcached_return_t rc= memcached_mget(memc, global_keys, global_keys_length, global_count); - test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); + test_true_got(memcached_success(rc), memcached_strerror(NULL, rc)); // Go fetch the keys and test to see if all of them were returned { @@ -3420,7 +3442,7 @@ static test_return_t mget_read_result(memcached_st *memc) memcached_return_t rc= memcached_mget(memc, global_keys, global_keys_length, global_count); - test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); + test_true_got(memcached_success(rc), memcached_strerror(NULL, rc)); /* Turn this into a help function */ { @@ -3447,7 +3469,7 @@ static test_return_t mget_read_function(memcached_st *memc) memcached_return_t rc= memcached_mget(memc, global_keys, global_keys_length, global_count); - test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); + test_true_got(memcached_success(rc), memcached_strerror(NULL, rc)); memcached_execute_fn callbacks[]= { &callback_counter }; size_t counter= 0; @@ -5954,6 +5976,8 @@ test_st tests[] ={ }; test_st behavior_tests[] ={ + {"libmemcached_string_behavior()", 0, (test_callback_fn)libmemcached_string_behavior_test}, + {"libmemcached_string_distribution()", 0, (test_callback_fn)libmemcached_string_distribution_test}, {"behavior_test", 0, (test_callback_fn)behavior_test}, {"MEMCACHED_BEHAVIOR_CORK", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_CORK_test}, {"MEMCACHED_BEHAVIOR_TCP_KEEPALIVE", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test},