From 827e4d284a3a5f3ac3fe4b8c0cf7a1840dda8d6c Mon Sep 17 00:00:00 2001 From: Tomas Varneckas <206971+tomasv@users.noreply.github.com> Date: Tue, 6 Feb 2024 15:33:08 +0200 Subject: [PATCH] Add Ruby 3.3 compatibility and bump version to 1.8.4 --- .ruby-version | 2 +- ext/rlibmemcached.i | 8 +- ext/rlibmemcached_wrap.c | 1137 ++++++++++++++++++++++---------------- lib/memcached/version.rb | 2 +- memcached.gemspec | Bin 13186 -> 13300 bytes 5 files changed, 673 insertions(+), 476 deletions(-) diff --git a/.ruby-version b/.ruby-version index 37c2961c..15a27998 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.2 +3.3.0 diff --git a/ext/rlibmemcached.i b/ext/rlibmemcached.i index 7d6fcfd9..69e583af 100644 --- a/ext/rlibmemcached.i +++ b/ext/rlibmemcached.i @@ -3,6 +3,7 @@ #include #include #include +#include %} %warnfilter(SWIGWARN_RUBY_WRONG_NAME) memcached_st; @@ -161,7 +162,12 @@ VALUE rb_str_new_by_ref(char *ptr, long len) #ifdef RSTRING_NOEMBED /* Ruby 1.9 */ str->as.heap.ptr = ptr; - str->as.heap.len = len; + #if RUBY_API_VERSION_MAJOR < 3 || (RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR < 3) + str->as.heap.len = len; + #else + // Ruby 3.3.0 moved the len field out of heap into toplevel RString + str->len = len; + #endif str->as.heap.aux.capa = len + 1; // Set STR_NOEMBED FL_SET(str, FL_USER1); diff --git a/ext/rlibmemcached_wrap.c b/ext/rlibmemcached_wrap.c index f7859d39..18130718 100644 --- a/ext/rlibmemcached_wrap.c +++ b/ext/rlibmemcached_wrap.c @@ -1,13 +1,13 @@ /* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.9 - * - * This file is not intended to be easily readable and contains a number of - * coding conventions designed to improve portability and efficiency. Do not make - * changes to this file unless you know what you are doing--modify the SWIG - * interface file instead. + * This file was automatically generated by SWIG (https://www.swig.org). + * Version 4.2.0 + * + * Do not make changes to this file unless you know what you are doing - modify + * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ + +#define SWIG_VERSION 0x040200 #define SWIGRUBY /* ----------------------------------------------------------------------------- @@ -41,28 +41,28 @@ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else -# define SWIGUNUSED +# define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif +# endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif @@ -77,9 +77,11 @@ #endif /* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif # endif #endif @@ -105,7 +107,7 @@ # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL -# endif +# endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ @@ -118,6 +120,45 @@ # define _SCL_SECURE_NO_DEPRECATE #endif +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + +#if __cplusplus >=201103L +# define SWIG_NULLPTR nullptr +#else +# define SWIG_NULLPTR NULL +#endif + + +/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF + * if you're missing it. + */ +#if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \ + (defined __cplusplus && __cplusplus >= 201103L) || \ + defined SWIG_HAVE_SNPRINTF) && \ + !defined SWIG_NO_SNPRINTF +# define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A) +# define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B) +#else +/* Fallback versions ignore the buffer size, but most of our uses either have a + * fixed maximum possible size or dynamically allocate a buffer that's large + * enough. + */ +# define SWIG_snprintf(O,S,F,A) sprintf(O,F,A) +# define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B) +#endif + /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable @@ -150,28 +191,28 @@ #ifndef SWIGUNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else # define SWIGUNUSED # endif # elif defined(__ICC) -# define SWIGUNUSED __attribute__ ((__unused__)) +# define SWIGUNUSED __attribute__ ((__unused__)) # else -# define SWIGUNUSED +# define SWIGUNUSED # endif #endif #ifndef SWIG_MSC_UNSUPPRESS_4505 # if defined(_MSC_VER) # pragma warning(disable : 4505) /* unreferenced local function has been removed */ -# endif +# endif #endif #ifndef SWIGUNUSEDPARM # ifdef __cplusplus # define SWIGUNUSEDPARM(p) # else -# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# define SWIGUNUSEDPARM(p) p SWIGUNUSED # endif #endif @@ -186,9 +227,11 @@ #endif /* exporting methods */ -#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# ifndef GCC_HASCLASSVISIBILITY -# define GCC_HASCLASSVISIBILITY +#if defined(__GNUC__) +# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif # endif #endif @@ -214,7 +257,7 @@ # define SWIGSTDCALL __stdcall # else # define SWIGSTDCALL -# endif +# endif #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ @@ -227,6 +270,25 @@ # define _SCL_SECURE_NO_DEPRECATE #endif +/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */ +#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES) +# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0 +#endif + +/* Intel's compiler complains if a variable which was never initialised is + * cast to void, which is a common idiom which we use to indicate that we + * are aware a variable isn't used. So we just silence that warning. + * See: https://github.com/swig/swig/issues/192 for more discussion. + */ +#ifdef __INTEL_COMPILER +# pragma warning disable 592 +#endif + +#if __cplusplus >=201103L +# define SWIG_NULLPTR nullptr +#else +# define SWIG_NULLPTR NULL +#endif /* ----------------------------------------------------------------------------- * swigrun.swg @@ -252,7 +314,7 @@ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for creating a static or dynamic library from the SWIG runtime code. In 99.9% of the cases, SWIG just needs to declare them as 'static'. - + But only do this if strictly necessary, ie, if you have problems with your compiler or suchlike. */ @@ -273,21 +335,24 @@ /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 #define SWIG_CAST_NEW_MEMORY 0x2 +#define SWIG_POINTER_NO_NULL 0x4 +#define SWIG_POINTER_CLEAR 0x8 +#define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN) /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 -/* +/* Flags/methods for returning states. - - The SWIG conversion methods, as ConvertPtr, return an integer + + The SWIG conversion methods, as ConvertPtr, return an integer that tells if the conversion was successful or not. And if not, an error code can be returned (see swigerrors.swg for the codes). - + Use the following macros/flags to set or process the returning states. - + In old versions of SWIG, code such as the following was usually written: if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) { @@ -320,23 +385,23 @@ } else { // fail code } - + I.e., now SWIG_ConvertPtr can return new objects and you can identify the case and take care of the deallocation. Of course that also requires SWIG_ConvertPtr to return new result values, such as - int SWIG_ConvertPtr(obj, ptr,...) { - if () { - if () { - *ptr = ; - return SWIG_NEWOBJ; - } else { - *ptr = ; - return SWIG_OLDOBJ; - } - } else { - return SWIG_BADOBJ; - } + int SWIG_ConvertPtr(obj, ptr,...) { + if () { + if () { + *ptr = ; + return SWIG_NEWOBJ; + } else { + *ptr = ; + return SWIG_OLDOBJ; + } + } else { + return SWIG_BADOBJ; + } } Of course, returning the plain '0(success)/-1(fail)' still works, but you can be @@ -344,36 +409,42 @@ SWIG errors code. Finally, if the SWIG_CASTRANK_MODE is enabled, the result code - allows to return the 'cast rank', for example, if you have this + allows returning the 'cast rank', for example, if you have this int food(double) int fooi(int); and you call - + food(1) // cast rank '1' (1 -> 1.0) fooi(1) // cast rank '0' just use the SWIG_AddCast()/SWIG_CheckState() */ -#define SWIG_OK (0) +#define SWIG_OK (0) +/* Runtime errors are < 0 */ #define SWIG_ERROR (-1) +/* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */ +/* Errors in range -100 to -199 are language specific errors defined in *errors.swg */ +/* Errors < -200 are generic runtime specific errors */ +#define SWIG_ERROR_RELEASE_NOT_OWNED (-200) + #define SWIG_IsOK(r) (r >= 0) -#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) +#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError) /* The CastRankLimit says how many bits are used for the cast rank */ #define SWIG_CASTRANKLIMIT (1 << 8) /* The NewMask denotes the object was created (using new/malloc) */ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1) -/* The TmpMask is for in/out typemaps that use temporal objects */ +/* The TmpMask is for in/out typemaps that use temporary objects */ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1) /* Simple returning values */ #define SWIG_BADOBJ (SWIG_ERROR) #define SWIG_OLDOBJ (SWIG_OK) #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK) #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK) -/* Check, add and del mask methods */ +/* Check, add and del object mask methods */ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r) #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r) #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK)) @@ -391,14 +462,14 @@ # endif # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1) # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK) -SWIGINTERNINLINE int SWIG_AddCast(int r) { +SWIGINTERNINLINE int SWIG_AddCast(int r) { return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r; } -SWIGINTERNINLINE int SWIG_CheckState(int r) { - return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; +SWIGINTERNINLINE int SWIG_CheckState(int r) { + return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; } #else /* no cast-rank mode */ -# define SWIG_AddCast +# define SWIG_AddCast(r) (r) # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0) #endif @@ -442,7 +513,7 @@ typedef struct swig_module_info { void *clientdata; /* Language specific module data */ } swig_module_info; -/* +/* Compare two type names skipping the space characters, therefore "char*" == "char *" and "Class" == "Class", etc. @@ -462,18 +533,18 @@ SWIG_TypeNameComp(const char *f1, const char *l1, /* Check type equivalence in a name list like ||... - Return 0 if not equal, 1 if equal + Return 0 if equal, -1 if nb < tb, 1 if nb > tb */ SWIGRUNTIME int -SWIG_TypeEquiv(const char *nb, const char *tb) { - int equiv = 0; +SWIG_TypeCmp(const char *nb, const char *tb) { + int equiv = 1; const char* te = tb + strlen(tb); const char* ne = nb; - while (!equiv && *ne) { + while (equiv != 0 && *ne) { for (nb = ne; *ne; ++ne) { if (*ne == '|') break; } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; + equiv = SWIG_TypeNameComp(nb, ne, tb, te); if (*ne) ++ne; } return equiv; @@ -481,24 +552,13 @@ SWIG_TypeEquiv(const char *nb, const char *tb) { /* Check type equivalence in a name list like ||... - Return 0 if equal, -1 if nb < tb, 1 if nb > tb + Return 0 if not equal, 1 if equal */ SWIGRUNTIME int -SWIG_TypeCompare(const char *nb, const char *tb) { - int equiv = 0; - const char* te = tb + strlen(tb); - const char* ne = nb; - while (!equiv && *ne) { - for (nb = ne; *ne; ++ne) { - if (*ne == '|') break; - } - equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0; - if (*ne) ++ne; - } - return equiv; +SWIG_TypeEquiv(const char *nb, const char *tb) { + return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0; } - /* Check the typename */ @@ -526,11 +586,11 @@ SWIG_TypeCheck(const char *c, swig_type_info *ty) { return 0; } -/* +/* Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison */ SWIGRUNTIME swig_cast_info * -SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) { +SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) { if (ty) { swig_cast_info *iter = ty->cast; while (iter) { @@ -561,7 +621,7 @@ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } -/* +/* Dynamic pointer casting. Down an inheritance hierarchy */ SWIGRUNTIME swig_type_info * @@ -590,9 +650,9 @@ SWIG_TypeName(const swig_type_info *ty) { SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type) { /* The "str" field contains the equivalent pretty names of the - type, separated by vertical-bar characters. We choose - to print the last name, as it is often (?) the most - specific. */ + type, separated by vertical-bar characters. Choose the last + name. It should be the most specific; a fully resolved name + but not necessarily with default template parameters expanded. */ if (!type) return NULL; if (type->str != NULL) { const char *last_name = type->str; @@ -605,7 +665,7 @@ SWIG_TypePrettyName(const swig_type_info *type) { return type->name; } -/* +/* Set the clientdata field for a type */ SWIGRUNTIME void @@ -613,14 +673,14 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) { swig_cast_info *cast = ti->cast; /* if (ti->clientdata == clientdata) return; */ ti->clientdata = clientdata; - + while (cast) { if (!cast->converter) { swig_type_info *tc = cast->type; if (!tc->clientdata) { SWIG_TypeClientData(tc, clientdata); } - } + } cast = cast->next; } } @@ -629,31 +689,31 @@ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) { SWIG_TypeClientData(ti, clientdata); ti->owndata = 1; } - + /* Search for a swig_type_info structure only by mangled name Search is a O(log #types) - - We start searching at module start, and finish searching when start == end. + + We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * -SWIG_MangledTypeQueryModule(swig_module_info *start, - swig_module_info *end, +SWIG_MangledTypeQueryModule(swig_module_info *start, + swig_module_info *end, const char *name) { swig_module_info *iter = start; do { if (iter->size) { - register size_t l = 0; - register size_t r = iter->size - 1; + size_t l = 0; + size_t r = iter->size - 1; do { /* since l+r >= 0, we can (>> 1) instead (/ 2) */ - register size_t i = (l + r) >> 1; + size_t i = (l + r) >> 1; const char *iname = iter->types[i]->name; if (iname) { - register int compare = strcmp(name, iname); - if (compare == 0) { + int compare = strcmp(name, iname); + if (compare == 0) { return iter->types[i]; } else if (compare < 0) { if (i) { @@ -678,14 +738,14 @@ SWIG_MangledTypeQueryModule(swig_module_info *start, Search for a swig_type_info structure for either a mangled name or a human readable name. It first searches the mangled names of the types, which is a O(log #types) If a type is not found it then searches the human readable names, which is O(#types). - - We start searching at module start, and finish searching when start == end. + + We start searching at module start, and finish searching when start == end. Note: if start == end at the beginning of the function, we go all the way around the circular list. */ SWIGRUNTIME swig_type_info * -SWIG_TypeQueryModule(swig_module_info *start, - swig_module_info *end, +SWIG_TypeQueryModule(swig_module_info *start, + swig_module_info *end, const char *name) { /* STEP 1: Search the name field using binary search */ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name); @@ -696,7 +756,7 @@ SWIG_TypeQueryModule(swig_module_info *start, of the str field (the human readable name) */ swig_module_info *iter = start; do { - register size_t i = 0; + size_t i = 0; for (; i < iter->size; ++i) { if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name))) return iter->types[i]; @@ -704,56 +764,56 @@ SWIG_TypeQueryModule(swig_module_info *start, iter = iter->next; } while (iter != end); } - + /* neither found a match */ return 0; } -/* +/* Pack binary data into a string */ SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz) { static const char hex[17] = "0123456789abcdef"; - register const unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + const unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register unsigned char uu = *u; + unsigned char uu = *u; *(c++) = hex[(uu & 0xf0) >> 4]; *(c++) = hex[uu & 0xf]; } return c; } -/* +/* Unpack binary data from a string */ SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { - register unsigned char *u = (unsigned char *) ptr; - register const unsigned char *eu = u + sz; + unsigned char *u = (unsigned char *) ptr; + const unsigned char *eu = u + sz; for (; u != eu; ++u) { - register char d = *(c++); - register unsigned char uu; + char d = *(c++); + unsigned char uu; if ((d >= '0') && (d <= '9')) - uu = ((d - '0') << 4); + uu = (unsigned char)((d - '0') << 4); else if ((d >= 'a') && (d <= 'f')) - uu = ((d - ('a'-10)) << 4); - else + uu = (unsigned char)((d - ('a'-10)) << 4); + else return (char *) 0; d = *(c++); if ((d >= '0') && (d <= '9')) - uu |= (d - '0'); + uu |= (unsigned char)(d - '0'); else if ((d >= 'a') && (d <= 'f')) - uu |= (d - ('a'-10)); - else + uu |= (unsigned char)(d - ('a'-10)); + else return (char *) 0; *u = uu; } return c; } -/* +/* Pack 'void *' into a string buffer. */ SWIGRUNTIME char * @@ -812,24 +872,41 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { } #endif -/* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 +/* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */ +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 #define SWIG_SystemError -10 #define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 +#define SWIG_MemoryError -12 #define SWIG_NullReferenceError -13 +#if __GNUC__ >= 7 +#pragma GCC diagnostic push +#if defined(__cplusplus) +#pragma GCC diagnostic ignored "-Wregister" +#if __GNUC__ >= 10 +#pragma GCC diagnostic ignored "-Wvolatile" +#if __GNUC__ >= 11 +#pragma GCC diagnostic ignored "-Wdeprecated-enum-enum-conversion" +#endif +#endif +#endif +#endif #include +#include /* For RUBY_API_VERSION_CODE */ + +#if __GNUC__ >= 7 +#pragma GCC diagnostic pop +#endif /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which * breaks using rb_intern as an lvalue, as SWIG does. We work around this @@ -922,42 +999,53 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #ifndef RSTRUCT_PTR # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr #endif +#ifndef RTYPEDDATA_P +# define RTYPEDDATA_P(x) (TYPE(x) != T_DATA) +#endif /* - * Need to be very careful about how these macros are defined, especially - * when compiling C++ code or C code with an ANSI C compiler. + * The following macros are used for providing the correct type of a + * function pointer to the Ruby C API. + * + * Starting with Ruby 2.7 these macros act transparently due to Ruby's moving + * moving away from ANYARGS and instead employing strict function signatures. * - * VALUEFUNC(f) is a macro used to typecast a C function that implements - * a Ruby method so that it can be passed as an argument to API functions - * like rb_define_method() and rb_define_singleton_method(). + * Note: In case of C (not C++) the macros are transparent even before + * Ruby 2.7 due to the fact that the Ruby C API used function declarators + * with empty parentheses, which allows for an unspecified number of + * arguments. * - * VOIDFUNC(f) is a macro used to typecast a C function that implements - * either the "mark" or "free" stuff for a Ruby Data object, so that it - * can be passed as an argument to API functions like Data_Wrap_Struct() + * PROTECTFUNC(f) is used for the function pointer argument of the Ruby + * C API function rb_protect(). + * + * VALUEFUNC(f) is used for the function pointer argument(s) of Ruby C API + * functions like rb_define_method() and rb_define_singleton_method(). + * + * VOIDFUNC(f) is used to typecast a C function that implements either + * the "mark" or "free" stuff for a Ruby Data object, so that it can be + * passed as an argument to Ruby C API functions like Data_Wrap_Struct() * and Data_Make_Struct(). + * + * SWIG_RUBY_VOID_ANYARGS_FUNC(f) is used for the function pointer + * argument(s) of Ruby C API functions like rb_define_virtual_variable(). + * + * SWIG_RUBY_INT_ANYARGS_FUNC(f) is used for the function pointer + * argument(s) of Ruby C API functions like st_foreach(). */ - -#ifdef __cplusplus -# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((void (*)()) f) -# else -# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */ -# define PROTECTFUNC(f) ((VALUE (*)()) f) -# define VALUEFUNC(f) ((VALUE (*)()) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# else /* These definitions should work for Ruby 1.7+ */ -# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) -# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) -# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) -# endif -# endif +#if defined(__cplusplus) && RUBY_API_VERSION_CODE < 20700 +# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f) +# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f) +# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f) +# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) ((void (*)(ANYARGS))(f)) +# define SWIG_RUBY_INT_ANYARGS_FUNC(f) ((int (*)(ANYARGS))(f)) #else +# define PROTECTFUNC(f) (f) # define VALUEFUNC(f) (f) # define VOIDFUNC(f) (f) +# define SWIG_RUBY_VOID_ANYARGS_FUNC(f) (f) +# define SWIG_RUBY_INT_ANYARGS_FUNC(f) (f) #endif /* Don't use for expressions have side effect */ @@ -1099,7 +1187,7 @@ const char* Ruby_Format_TypeError( const char* msg, } str = rb_str_cat2( str, "Expected argument " ); - sprintf( buf, "%d of type ", argn-1 ); + SWIG_snprintf( buf, sizeof( buf), "%d of type ", argn-1 ); str = rb_str_cat2( str, buf ); str = rb_str_cat2( str, type ); str = rb_str_cat2( str, ", but got " ); @@ -1145,7 +1233,7 @@ void Ruby_Format_OverloadedError( /* ----------------------------------------------------------------------------- * rubytracking.swg * - * This file contains support for tracking mappings from + * This file contains support for tracking mappings from * Ruby objects to C++ objects. This functionality is needed * to implement mark functions for Ruby's mark and sweep * garbage collector. @@ -1155,6 +1243,11 @@ void Ruby_Format_OverloadedError( extern "C" { #endif +#if !defined(ST_DATA_T_DEFINED) +/* Needs to be explicitly included for Ruby 1.8 and earlier */ +#include +#endif + /* Ruby 1.8 actually assumes the first case. */ #if SIZEOF_VOIDP == SIZEOF_LONG # define SWIG2NUM(v) LONG2NUM((unsigned long)v) @@ -1166,109 +1259,69 @@ extern "C" { # error sizeof(void*) is not the same as long or long long #endif - -/* Global Ruby hash table to store Trackings from C/C++ - structs to Ruby Objects. +/* Global hash table to store Trackings from C/C++ + structs to Ruby Objects. */ -static VALUE swig_ruby_trackings = Qnil; +static st_table* swig_ruby_trackings = NULL; -/* Global variable that stores a reference to the ruby - hash table delete function. */ -static ID swig_ruby_hash_delete; +static VALUE swig_ruby_trackings_count(ID id, VALUE *var) { + return SWIG2NUM(swig_ruby_trackings->num_entries); +} -/* Setup a Ruby hash table to store Trackings */ + +/* Setup a hash table to store Trackings */ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) { - /* Create a ruby hash table to store Trackings from C++ + /* Create a hash table to store Trackings from C++ objects to Ruby objects. */ - /* Try to see if some other .so has already created a + /* Try to see if some other .so has already created a tracking hash table, which we keep hidden in an instance var in the SWIG module. This is done to allow multiple DSOs to share the same tracking table. */ - ID trackings_id = rb_intern( "@__trackings__" ); + VALUE trackings_value = Qnil; + /* change the variable name so that we can mix modules + compiled with older SWIG's - this used to be called "@__trackings__" */ + ID trackings_id = rb_intern( "@__safetrackings__" ); VALUE verbose = rb_gv_get("VERBOSE"); rb_gv_set("VERBOSE", Qfalse); - swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id ); + trackings_value = rb_ivar_get( _mSWIG, trackings_id ); rb_gv_set("VERBOSE", verbose); - /* No, it hasn't. Create one ourselves */ - if ( swig_ruby_trackings == Qnil ) - { - swig_ruby_trackings = rb_hash_new(); - rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings ); - } - - /* Now store a reference to the hash table delete function - so that we only have to look it up once.*/ - swig_ruby_hash_delete = rb_intern("delete"); -} - -/* Get a Ruby number to reference a pointer */ -SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) { - /* We cast the pointer to an unsigned long - and then store a reference to it using - a Ruby number object. */ - - /* Convert the pointer to a Ruby number */ - return SWIG2NUM(ptr); -} - -/* Get a Ruby number to reference an object */ -SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) { - /* We cast the object to an unsigned long - and then store a reference to it using - a Ruby number object. */ - - /* Convert the Object to a Ruby number */ - return SWIG2NUM(object); -} - -/* Get a Ruby object from a previously stored reference */ -SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) { - /* The provided Ruby number object is a reference - to the Ruby object we want.*/ + /* The trick here is that we have to store the hash table + pointer in a Ruby variable. We do not want Ruby's GC to + treat this pointer as a Ruby object, so we convert it to + a Ruby numeric value. */ + if (trackings_value == Qnil) { + /* No, it hasn't. Create one ourselves */ + swig_ruby_trackings = st_init_numtable(); + rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) ); + } else { + swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value); + } - /* Convert the Ruby number to a Ruby object */ - return NUM2SWIG(reference); + rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", + VALUEFUNC(swig_ruby_trackings_count), + SWIG_RUBY_VOID_ANYARGS_FUNC((rb_gvar_setter_t*)NULL)); } /* Add a Tracking from a C/C++ struct to a Ruby object */ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) { - /* In a Ruby hash table we store the pointer and - the associated Ruby object. The trick here is - that we cannot store the Ruby object directly - if - we do then it cannot be garbage collected. So - instead we typecast it as a unsigned long and - convert it to a Ruby number object.*/ - - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Get a reference to the Ruby object as a Ruby number */ - VALUE value = SWIG_RubyObjectToReference(object); - /* Store the mapping to the global hash table. */ - rb_hash_aset(swig_ruby_trackings, key, value); + st_insert(swig_ruby_trackings, (st_data_t)ptr, object); } /* Get the Ruby object that owns the specified C/C++ struct */ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) { - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - /* Now lookup the value stored in the global hash table */ - VALUE value = rb_hash_aref(swig_ruby_trackings, key); - - if (value == Qnil) { - /* No object exists - return nil. */ + VALUE value; + + if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) { + return value; + } else { return Qnil; } - else { - /* Convert this value to Ruby object */ - return SWIG_RubyReferenceToObject(value); - } } /* Remove a Tracking from a C/C++ struct to a Ruby object. It @@ -1276,25 +1329,39 @@ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) { since the same memory address may be reused later to create a new object. */ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) { - /* Get a reference to the pointer as a Ruby number */ - VALUE key = SWIG_RubyPtrToReference(ptr); - - /* Delete the object from the hash table by calling Ruby's - do this we need to call the Hash.delete method.*/ - rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key); + /* Delete the object from the hash table */ + st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL); } /* This is a helper method that unlinks a Ruby object from its underlying C++ object. This is needed if the lifetime of the - Ruby object is longer than the C++ object */ + Ruby object is longer than the C++ object. */ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) { VALUE object = SWIG_RubyInstanceFor(ptr); if (object != Qnil) { + // object might have the T_ZOMBIE type, but that's just + // because the GC has flagged it as such for a deferred + // destruction. Until then, it's still a T_DATA object. DATA_PTR(object) = 0; } } +/* This is a helper method that iterates over all the trackings + passing the C++ object pointer and its related Ruby object + to the passed callback function. */ + +/* Proxy method to abstract the internal trackings datatype */ +static int swig_ruby_internal_iterate_callback(st_data_t ptr, st_data_t obj, st_data_t meth) { + ((void (*) (void *, VALUE))meth)((void *)ptr, (VALUE)obj); + return ST_CONTINUE; +} + +SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) { + st_foreach(swig_ruby_trackings, + SWIG_RUBY_INT_ANYARGS_FUNC(swig_ruby_internal_iterate_callback), + (st_data_t)meth); +} #ifdef __cplusplus } @@ -1353,7 +1420,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) { #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags) #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own) -#define swig_owntype ruby_owntype +#define swig_owntype swig_ruby_owntype /* for raw packed data */ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags) @@ -1419,6 +1486,7 @@ static VALUE swig_runtime_data_type_pointer = Qnil; /* Global IDs used to keep some internal SWIG stuff */ static ID swig_arity_id = 0; static ID swig_call_id = 0; +static ID swig_lowerthan_id = 0; /* If your swig extension is to be run within an embedded ruby and has @@ -1470,7 +1538,7 @@ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) { VALUE exceptionClass = getExceptionClass(); if (rb_obj_is_kind_of(obj, exceptionClass)) { return obj; - } else { + } else { return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj)); } } @@ -1483,6 +1551,7 @@ SWIG_Ruby_InitRuntime(void) _mSWIG = rb_define_module("SWIG"); swig_call_id = rb_intern("call"); swig_arity_id = rb_intern("arity"); + swig_lowerthan_id = rb_intern("<"); } } @@ -1490,14 +1559,14 @@ SWIG_Ruby_InitRuntime(void) SWIGRUNTIME void SWIG_Ruby_define_class(swig_type_info *type) { - VALUE klass; - char *klass_name = (char *) malloc(4 + strlen(type->name) + 1); - sprintf(klass_name, "TYPE%s", type->name); + size_t klass_len = 4 + strlen(type->name) + 1; + char *klass_name = (char *) malloc(klass_len); + SWIG_snprintf(klass_name, klass_len, "TYPE%s", type->name); if (NIL_P(_cSWIG_Pointer)) { _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } - klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + rb_undef_alloc_func(rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer)); free((void *) klass_name); } @@ -1511,10 +1580,11 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) swig_class *sklass; VALUE klass; VALUE obj; - + if (!ptr) return Qnil; - + + assert(type); if (type->clientdata) { sklass = (swig_class *) type->clientdata; @@ -1522,7 +1592,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) track = sklass->trackObjects; if (track) { obj = SWIG_RubyInstanceFor(ptr); - + /* Check the object's type and make sure it has the correct type. It might not in cases where methods do things like downcast methods. */ @@ -1547,14 +1617,15 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags) SWIG_RubyAddTracking(ptr, obj); } } else { - klass_name = (char *) malloc(4 + strlen(type->name) + 1); - sprintf(klass_name, "TYPE%s", type->name); + size_t klass_len = 4 + strlen(type->name) + 1; + klass_name = (char *) malloc(klass_len); + SWIG_snprintf(klass_name, klass_len, "TYPE%s", type->name); klass = rb_const_get(_mSWIG, rb_intern(klass_name)); free((void *) klass_name); obj = Data_Wrap_Struct(klass, 0, 0, ptr); } rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name)); - + return obj; } @@ -1574,26 +1645,30 @@ SWIGRUNTIMEINLINE char * SWIG_Ruby_MangleStr(VALUE obj) { VALUE stype = rb_iv_get(obj, "@__swigtype__"); + if (NIL_P(stype)) + return NULL; return StringValuePtr(stype); } /* Acquire a pointer value */ -typedef void (*ruby_owntype)(void*); - -SWIGRUNTIME ruby_owntype -SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) { - if (obj) { - ruby_owntype oldown = RDATA(obj)->dfree; - RDATA(obj)->dfree = own; - return oldown; - } else { - return 0; +typedef struct { + void (*datafree)(void *); + int own; +} swig_ruby_owntype; + +SWIGRUNTIME swig_ruby_owntype +SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) { + swig_ruby_owntype oldown = {0, 0}; + if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) { + oldown.datafree = RDATA(obj)->dfree; + RDATA(obj)->dfree = own.datafree; } + return oldown; } /* Convert a pointer value */ SWIGRUNTIME int -SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own) +SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_ruby_owntype *own) { char *c; swig_cast_info *tc; @@ -1601,17 +1676,26 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, /* Grab the pointer */ if (NIL_P(obj)) { - *ptr = 0; - return SWIG_OK; + if (ptr) + *ptr = 0; + return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK; } else { - if (TYPE(obj) != T_DATA) { + if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) { return SWIG_ERROR; } Data_Get_Struct(obj, void, vptr); } - if (own) *own = RDATA(obj)->dfree; + if (own) { + own->datafree = RDATA(obj)->dfree; + own->own = 0; + } + if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE)) { + if (!RDATA(obj)->dfree) + return SWIG_ERROR_RELEASE_NOT_OWNED; + } + /* Check to see if the input object is giving up ownership of the underlying C struct or C++ object. If so then we need to reset the destructor since the Ruby object no @@ -1623,7 +1707,7 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_class *sklass = (swig_class *) ty->clientdata; track = sklass->trackObjects; } - + if (track) { /* We are tracking objects for this class. Thus we change the destructor * to SWIG_RubyRemoveTracking. This allows us to @@ -1637,6 +1721,10 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, } } + if (flags & SWIG_POINTER_CLEAR) { + DATA_PTR(obj) = 0; + } + /* Do type-checking if type info was provided */ if (ty) { if (ty->clientdata) { @@ -1645,8 +1733,6 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, /* The object has already been deleted */ return SWIG_ObjectPreviouslyDeletedError; } - *ptr = vptr; - return SWIG_OK; } } if ((c = SWIG_MangleStr(obj)) == NULL) { @@ -1656,12 +1742,23 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, if (!tc) { return SWIG_ERROR; } else { - int newmemory = 0; - *ptr = SWIG_TypeCast(tc, vptr, &newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ + if (ptr) { + if (tc->type == ty) { + *ptr = vptr; + } else { + int newmemory = 0; + *ptr = SWIG_TypeCast(tc, vptr, &newmemory); + if (newmemory == SWIG_CAST_NEW_MEMORY) { + assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */ + if (own) + own->own = own->own | SWIG_CAST_NEW_MEMORY; + } + } + } } } else { - *ptr = vptr; + if (ptr) + *ptr = vptr; } return SWIG_OK; @@ -1687,7 +1784,7 @@ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) { return rb_str_new2(result); } -/* Convert a packed value value */ +/* Convert a packed pointer value */ SWIGRUNTIME int SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) { swig_cast_info *tc; @@ -1735,6 +1832,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer) { /* register a new class */ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject); + rb_undef_alloc_func(cl); /* create and store the structure pointer to a global variable */ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer); rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer); @@ -1750,7 +1848,7 @@ SWIG_Ruby_SetModule(swig_module_info *pointer) SWIGINTERN int SWIG_Ruby_isCallable( VALUE proc ) { - if ( rb_respond_to( proc, swig_call_id ) == Qtrue ) + if ( rb_respond_to( proc, swig_call_id ) ) return 1; return 0; } @@ -1763,9 +1861,9 @@ int SWIG_Ruby_isCallable( VALUE proc ) SWIGINTERN int SWIG_Ruby_arity( VALUE proc, int minimal ) { - if ( rb_respond_to( proc, swig_arity_id ) == Qtrue ) + if ( rb_respond_to( proc, swig_arity_id ) ) { - VALUE num = rb_funcall( proc, swig_arity_id, 0 ); + VALUE num = rb_funcall2( proc, swig_arity_id, 0, 0 ); int arity = NUM2INT(num); if ( arity < 0 && (arity+1) < -minimal ) return 1; if ( arity == minimal ) return 1; @@ -1783,7 +1881,7 @@ int SWIG_Ruby_arity( VALUE proc, int minimal ) #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) -#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else +#define SWIG_contract_assert(expr, msg) do { if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } } while (0) @@ -1838,10 +1936,6 @@ static VALUE mRlibmemcached; #define SWIG_RUBY_THREAD_END_BLOCK -#define SWIGVERSION 0x020009 -#define SWIG_VERSION SWIGVERSION - - #define SWIG_as_voidptr(a) (void *)((const void *)(a)) #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) @@ -1849,13 +1943,14 @@ static VALUE mRlibmemcached; #include #include #include +#include #ifdef __cplusplus extern "C" { #endif -// Ruby 1.9 changed the file name of this header +/* Ruby 1.9 changed the file name of this header */ #ifdef HAVE_RUBY_IO_H #include "ruby/io.h" #else @@ -1937,19 +2032,20 @@ SWIG_FromCharPtr(const char *cptr) SWIGINTERN VALUE -SWIG_ruby_failed(void) +SWIG_ruby_failed(VALUE SWIGUNUSEDPARM(arg1), VALUE SWIGUNUSEDPARM(arg2)) { return Qnil; } -/*@SWIG:/opt/local/share/swig/2.0.9/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args) +/*@SWIG:/opt/homebrew/Cellar/swig/4.2.0/share/swig/4.2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); double *res = (double *)(args[1]); - *res = NUM2DBL(obj); + *res = NUM2DBL(obj); (void)type; return obj; } /*@SWIG@*/ @@ -1963,7 +2059,7 @@ SWIG_AsVal_double (VALUE obj, double *val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2DBL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } @@ -1984,7 +2080,7 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc) if (cptr) { if (alloc) { if (*alloc == SWIG_NEWOBJ) { - *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size)); + *cptr = (char *)memcpy(malloc((size)*sizeof(char)), cstr, sizeof(char)*(size)); } else { *cptr = cstr; *alloc = SWIG_OLDOBJ; @@ -2015,7 +2111,8 @@ SWIG_AsCharArray(VALUE obj, char *val, size_t size) char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ; int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc); if (SWIG_IsOK(res)) { - if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize; + /* special case of single char conversion when we don't need space for NUL */ + if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize; if (csize <= size) { if (val) { if (csize) memcpy(val, cptr, csize*sizeof(char)); @@ -2033,9 +2130,20 @@ SWIG_AsCharArray(VALUE obj, char *val, size_t size) } -/*@SWIG:/opt/local/share/swig/2.0.9/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args) +SWIGINTERN size_t +SWIG_strnlen(const char* s, size_t maxlen) +{ + const char *p; + for (p = s; maxlen-- && *p; p++) + ; + return p - s; +} + + +/*@SWIG:/opt/homebrew/Cellar/swig/4.2.0/share/swig/4.2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); unsigned long *res = (unsigned long *)(args[1]); @@ -2053,7 +2161,9 @@ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_funcall(obj, swig_lowerthan_id, 1, INT2FIX(0)) != Qfalse) + return SWIG_OverflowError; if (val) *val = v; return SWIG_OK; } @@ -2092,9 +2202,10 @@ SWIG_From_unsigned_SS_short (unsigned short value) } -/*@SWIG:/opt/local/share/swig/2.0.9/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args) +/*@SWIG:/opt/homebrew/Cellar/swig/4.2.0/share/swig/4.2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE arg) { + VALUE *args = (VALUE *)arg; VALUE obj = args[0]; VALUE type = TYPE(obj); long *res = (long *)(args[1]); @@ -2112,7 +2223,7 @@ SWIG_AsVal_long (VALUE obj, long* val) VALUE a[2]; a[0] = obj; a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2LONG), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { if (val) *val = v; return SWIG_OK; } @@ -2164,38 +2275,92 @@ SWIG_From_bool (bool value) } -SWIGINTERNINLINE int -SWIG_AsVal_size_t (VALUE obj, size_t *val) -{ - unsigned long v; - int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); - if (SWIG_IsOK(res) && val) *val = (size_t)(v); - return res; -} +#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE) +# define SWIG_LONG_LONG_AVAILABLE +#endif -SWIGINTERNINLINE VALUE -SWIG_From_size_t (size_t value) -{ - return SWIG_From_unsigned_SS_long ((unsigned long)(value)); +#ifdef SWIG_LONG_LONG_AVAILABLE +/*@SWIG:/opt/homebrew/Cellar/swig/4.2.0/share/swig/4.2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ +SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE arg) +{ + VALUE *args = (VALUE *)arg; + VALUE obj = args[0]; + VALUE type = TYPE(obj); + long long *res = (long long *)(args[1]); + *res = type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj); + return obj; } +/*@SWIG@*/ +SWIGINTERN int +SWIG_AsVal_unsigned_SS_long_SS_long (VALUE obj, unsigned long long *val) +{ + VALUE type = TYPE(obj); + if ((type == T_FIXNUM) || (type == T_BIGNUM)) { + unsigned long long v; + VALUE a[2]; + a[0] = obj; + a[1] = (VALUE)(&v); + if (rb_rescue(VALUEFUNC(SWIG_AUX_NUM2ULL), (VALUE)a, VALUEFUNC(SWIG_ruby_failed), 0) != Qnil) { + if (rb_funcall(obj, swig_lowerthan_id, 1, INT2FIX(0)) != Qfalse) + return SWIG_OverflowError; + if (val) *val = v; + return SWIG_OK; + } + } + return SWIG_TypeError; +} +#endif - - -SWIGINTERNINLINE VALUE -SWIG_From_long_SS_long (long long value) +SWIGINTERNINLINE int +SWIG_AsVal_size_t (VALUE obj, size_t *val) { - return LL2NUM(value); + int res = SWIG_TypeError; +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +#endif + unsigned long v; + res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = (size_t)(v); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else if (sizeof(size_t) <= sizeof(unsigned long long)) { + unsigned long long v; + res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0); + if (SWIG_IsOK(res) && val) *val = (size_t)(v); + } +#endif + return res; } +#ifdef SWIG_LONG_LONG_AVAILABLE SWIGINTERNINLINE VALUE SWIG_From_unsigned_SS_long_SS_long (unsigned long long value) { return ULL2NUM(value); } +#endif + + +SWIGINTERNINLINE VALUE +SWIG_From_size_t (size_t value) +{ +#ifdef SWIG_LONG_LONG_AVAILABLE + if (sizeof(size_t) <= sizeof(unsigned long)) { +#endif + return SWIG_From_unsigned_SS_long ((unsigned long)(value)); +#ifdef SWIG_LONG_LONG_AVAILABLE + } else { + /* assume sizeof(size_t) <= sizeof(unsigned long long) */ + return SWIG_From_unsigned_SS_long_SS_long ((unsigned long long)(value)); + } +#endif +} + + + SWIGINTERN int @@ -2214,35 +2379,6 @@ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val) } -/*@SWIG:/opt/local/share/swig/2.0.9/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/ -SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE *args) -{ - VALUE obj = args[0]; - VALUE type = TYPE(obj); - long long *res = (long long *)(args[1]); - *res = type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj); - return obj; -} -/*@SWIG@*/ - -SWIGINTERN int -SWIG_AsVal_unsigned_SS_long_SS_long (VALUE obj, unsigned long long *val) -{ - VALUE type = TYPE(obj); - if ((type == T_FIXNUM) || (type == T_BIGNUM)) { - unsigned long long v; - VALUE a[2]; - a[0] = obj; - a[1] = (VALUE)(&v); - if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) { - if (val) *val = v; - return SWIG_OK; - } - } - return SWIG_TypeError; -} - - SWIGINTERNINLINE VALUE SWIG_From_unsigned_SS_int (unsigned int value) { @@ -2258,7 +2394,12 @@ VALUE rb_str_new_by_ref(char *ptr, long len) #ifdef RSTRING_NOEMBED /* Ruby 1.9 */ str->as.heap.ptr = ptr; - str->as.heap.len = len; + #if RUBY_API_VERSION_MAJOR < 3 || (RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR < 3) + str->as.heap.len = len; + #else + // Ruby 3.3.0 moved the len field out of heap into toplevel RString + str->len = len; + #endif str->as.heap.aux.capa = len + 1; // Set STR_NOEMBED FL_SET(str, FL_USER1); @@ -2806,22 +2947,20 @@ _wrap_MemcachedAnalysisSt_least_remaining_bytes_get(int argc, VALUE *argv, VALUE } -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE -_wrap_MemcachedAnalysisSt_allocate(VALUE self) { +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_MemcachedAnalysisSt_allocate(VALUE self) #else - SWIGINTERN VALUE - _wrap_MemcachedAnalysisSt_allocate(int argc, VALUE *argv, VALUE self) { +_wrap_MemcachedAnalysisSt_allocate(int argc, VALUE *argv, VALUE self) #endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_analysis_st); +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_analysis_st); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); + rb_obj_call_init(vresult, argc, argv); #endif - return vresult; - } - + return vresult; +} + SWIGINTERN VALUE _wrap_new_MemcachedAnalysisSt(int argc, VALUE *argv, VALUE self) { @@ -2839,7 +2978,8 @@ _wrap_new_MemcachedAnalysisSt(int argc, VALUE *argv, VALUE self) { SWIGINTERN void -free_memcached_analysis_st(struct memcached_analysis_st *arg1) { +free_memcached_analysis_st(void *self) { + struct memcached_analysis_st *arg1 = (struct memcached_analysis_st *)self; free((char *) arg1); } @@ -4251,7 +4391,7 @@ _wrap_MemcachedStatSt_limit_maxbytes_get(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_MemcachedStatSt_version_set(int argc, VALUE *argv, VALUE self) { struct memcached_stat_st *arg1 = (struct memcached_stat_st *) 0 ; - char *arg2 ; + char *arg2 = (char *) (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[24] ; @@ -4296,9 +4436,9 @@ _wrap_MemcachedStatSt_version_get(int argc, VALUE *argv, VALUE self) { arg1 = (struct memcached_stat_st *)(argp1); result = (char *)(char *) ((arg1)->version); { - size_t size = 24; + size_t size = SWIG_strnlen(result, 24); + - while (size && (result[size - 1] == '\0')) --size; vresult = SWIG_FromCharPtrAndSize(result, size); } @@ -4308,22 +4448,20 @@ _wrap_MemcachedStatSt_version_get(int argc, VALUE *argv, VALUE self) { } -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE -_wrap_MemcachedStatSt_allocate(VALUE self) { +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_MemcachedStatSt_allocate(VALUE self) #else - SWIGINTERN VALUE - _wrap_MemcachedStatSt_allocate(int argc, VALUE *argv, VALUE self) { +_wrap_MemcachedStatSt_allocate(int argc, VALUE *argv, VALUE self) #endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_stat_st); +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_stat_st); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); + rb_obj_call_init(vresult, argc, argv); #endif - return vresult; - } - + return vresult; +} + SWIGINTERN VALUE _wrap_new_MemcachedStatSt(int argc, VALUE *argv, VALUE self) { @@ -4501,7 +4639,6 @@ _wrap_MemcachedSt_distribution_get(int argc, VALUE *argv, VALUE self) { } - /* Document-method: Rlibmemcached::MemcachedSt.hash @@ -4510,7 +4647,6 @@ _wrap_MemcachedSt_distribution_get(int argc, VALUE *argv, VALUE self) { Hashing function for class. */ - /* Document-method: Rlibmemcached::MemcachedSt.hash= @@ -4738,7 +4874,7 @@ _wrap_MemcachedSt_snd_timeout_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->snd_timeout); - vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)malloc(sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)calloc(1,sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -4797,7 +4933,66 @@ _wrap_MemcachedSt_rcv_timeout_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->rcv_timeout); - vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)malloc(sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)calloc(1,sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); + return vresult; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_MemcachedSt_poll_max_retries_set(int argc, VALUE *argv, VALUE self) { + struct memcached_st *arg1 = (struct memcached_st *) 0 ; + int32_t arg2 ; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 ; + int res2 = 0 ; + + if ((argc < 1) || (argc > 1)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_memcached_st, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct memcached_st *","poll_max_retries", 1, self )); + } + arg1 = (struct memcached_st *)(argp1); + { + res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_int32_t, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "int32_t","poll_max_retries", 2, argv[0] )); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "int32_t","poll_max_retries", 2, argv[0])); + } else { + arg2 = *((int32_t *)(argp2)); + } + } + if (arg1) (arg1)->poll_max_retries = arg2; + return Qnil; +fail: + return Qnil; +} + + +SWIGINTERN VALUE +_wrap_MemcachedSt_poll_max_retries_get(int argc, VALUE *argv, VALUE self) { + struct memcached_st *arg1 = (struct memcached_st *) 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + int32_t result; + VALUE vresult = Qnil; + + if ((argc < 0) || (argc > 0)) { + rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail; + } + res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_memcached_st, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct memcached_st *","poll_max_retries", 1, self )); + } + arg1 = (struct memcached_st *)(argp1); + result = ((arg1)->poll_max_retries); + vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)calloc(1,sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -5328,7 +5523,7 @@ _wrap_MemcachedSt_poll_timeout_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->poll_timeout); - vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)malloc(sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)calloc(1,sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -5387,7 +5582,7 @@ _wrap_MemcachedSt_connect_timeout_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->connect_timeout); - vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)malloc(sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)calloc(1,sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -5446,7 +5641,7 @@ _wrap_MemcachedSt_retry_timeout_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->retry_timeout); - vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)malloc(sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((int32_t *)memcpy((int32_t *)calloc(1,sizeof(int32_t)),&result,sizeof(int32_t)), SWIGTYPE_p_int32_t, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -5690,7 +5885,7 @@ _wrap_MemcachedSt_next_distribution_rebuild_set(int argc, VALUE *argv, VALUE sel if (NIL_P(argv[0])) arg2 = (time_t)-1; else - arg2 = NUM2LONG(rb_funcall(argv[0], rb_intern("tv_sec"), 0)); + arg2 = NUM2LONG(rb_funcall2(argv[0], rb_intern("tv_sec"), 0, 0)); } if (arg1) (arg1)->next_distribution_rebuild = arg2; return Qnil; @@ -5883,7 +6078,7 @@ _wrap_MemcachedSt_result_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->result); - vresult = SWIG_NewPointerObj((memcached_result_st *)memcpy((memcached_result_st *)malloc(sizeof(memcached_result_st)),&result,sizeof(memcached_result_st)), SWIGTYPE_p_memcached_result_st, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_result_st *)memcpy((memcached_result_st *)calloc(1,sizeof(memcached_result_st)),&result,sizeof(memcached_result_st)), SWIGTYPE_p_memcached_result_st, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -5995,7 +6190,7 @@ _wrap_MemcachedSt_on_clone_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->on_clone); - vresult = SWIG_NewPointerObj((memcached_clone_func *)memcpy((memcached_clone_func *)malloc(sizeof(memcached_clone_func)),&result,sizeof(memcached_clone_func)), SWIGTYPE_p_memcached_clone_func, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_clone_func *)memcpy((memcached_clone_func *)calloc(1,sizeof(memcached_clone_func)),&result,sizeof(memcached_clone_func)), SWIGTYPE_p_memcached_clone_func, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6054,7 +6249,7 @@ _wrap_MemcachedSt_on_cleanup_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->on_cleanup); - vresult = SWIG_NewPointerObj((memcached_cleanup_func *)memcpy((memcached_cleanup_func *)malloc(sizeof(memcached_cleanup_func)),&result,sizeof(memcached_cleanup_func)), SWIGTYPE_p_memcached_cleanup_func, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_cleanup_func *)memcpy((memcached_cleanup_func *)calloc(1,sizeof(memcached_cleanup_func)),&result,sizeof(memcached_cleanup_func)), SWIGTYPE_p_memcached_cleanup_func, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6113,7 +6308,7 @@ _wrap_MemcachedSt_call_free_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->call_free); - vresult = SWIG_NewPointerObj((memcached_free_function *)memcpy((memcached_free_function *)malloc(sizeof(memcached_free_function)),&result,sizeof(memcached_free_function)), SWIGTYPE_p_memcached_free_function, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_free_function *)memcpy((memcached_free_function *)calloc(1,sizeof(memcached_free_function)),&result,sizeof(memcached_free_function)), SWIGTYPE_p_memcached_free_function, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6172,7 +6367,7 @@ _wrap_MemcachedSt_call_malloc_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->call_malloc); - vresult = SWIG_NewPointerObj((memcached_malloc_function *)memcpy((memcached_malloc_function *)malloc(sizeof(memcached_malloc_function)),&result,sizeof(memcached_malloc_function)), SWIGTYPE_p_memcached_malloc_function, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_malloc_function *)memcpy((memcached_malloc_function *)calloc(1,sizeof(memcached_malloc_function)),&result,sizeof(memcached_malloc_function)), SWIGTYPE_p_memcached_malloc_function, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6231,7 +6426,7 @@ _wrap_MemcachedSt_call_realloc_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->call_realloc); - vresult = SWIG_NewPointerObj((memcached_realloc_function *)memcpy((memcached_realloc_function *)malloc(sizeof(memcached_realloc_function)),&result,sizeof(memcached_realloc_function)), SWIGTYPE_p_memcached_realloc_function, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_realloc_function *)memcpy((memcached_realloc_function *)calloc(1,sizeof(memcached_realloc_function)),&result,sizeof(memcached_realloc_function)), SWIGTYPE_p_memcached_realloc_function, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6290,7 +6485,7 @@ _wrap_MemcachedSt_call_calloc_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->call_calloc); - vresult = SWIG_NewPointerObj((memcached_calloc_function *)memcpy((memcached_calloc_function *)malloc(sizeof(memcached_calloc_function)),&result,sizeof(memcached_calloc_function)), SWIGTYPE_p_memcached_calloc_function, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_calloc_function *)memcpy((memcached_calloc_function *)calloc(1,sizeof(memcached_calloc_function)),&result,sizeof(memcached_calloc_function)), SWIGTYPE_p_memcached_calloc_function, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6349,7 +6544,7 @@ _wrap_MemcachedSt_get_key_failure_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->get_key_failure); - vresult = SWIG_NewPointerObj((memcached_trigger_key *)memcpy((memcached_trigger_key *)malloc(sizeof(memcached_trigger_key)),&result,sizeof(memcached_trigger_key)), SWIGTYPE_p_memcached_trigger_key, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_trigger_key *)memcpy((memcached_trigger_key *)calloc(1,sizeof(memcached_trigger_key)),&result,sizeof(memcached_trigger_key)), SWIGTYPE_p_memcached_trigger_key, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6408,7 +6603,7 @@ _wrap_MemcachedSt_delete_trigger_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_st *)(argp1); result = ((arg1)->delete_trigger); - vresult = SWIG_NewPointerObj((memcached_trigger_delete_key *)memcpy((memcached_trigger_delete_key *)malloc(sizeof(memcached_trigger_delete_key)),&result,sizeof(memcached_trigger_delete_key)), SWIGTYPE_p_memcached_trigger_delete_key, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_trigger_delete_key *)memcpy((memcached_trigger_delete_key *)calloc(1,sizeof(memcached_trigger_delete_key)),&result,sizeof(memcached_trigger_delete_key)), SWIGTYPE_p_memcached_trigger_delete_key, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -6418,7 +6613,7 @@ _wrap_MemcachedSt_delete_trigger_get(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_MemcachedSt_prefix_key_set(int argc, VALUE *argv, VALUE self) { struct memcached_st *arg1 = (struct memcached_st *) 0 ; - char *arg2 ; + char *arg2 = (char *) (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[MEMCACHED_PREFIX_KEY_MAX_SIZE] ; @@ -6463,9 +6658,9 @@ _wrap_MemcachedSt_prefix_key_get(int argc, VALUE *argv, VALUE self) { arg1 = (struct memcached_st *)(argp1); result = (char *)(char *) ((arg1)->prefix_key); { - size_t size = MEMCACHED_PREFIX_KEY_MAX_SIZE; + size_t size = SWIG_strnlen(result, MEMCACHED_PREFIX_KEY_MAX_SIZE); + - while (size && (result[size - 1] == '\0')) --size; vresult = SWIG_FromCharPtrAndSize(result, size); } @@ -6756,22 +6951,20 @@ _wrap_MemcachedSt_last_server_key_get(int argc, VALUE *argv, VALUE self) { } -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE -_wrap_MemcachedSt_allocate(VALUE self) { +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_MemcachedSt_allocate(VALUE self) #else - SWIGINTERN VALUE - _wrap_MemcachedSt_allocate(int argc, VALUE *argv, VALUE self) { +_wrap_MemcachedSt_allocate(int argc, VALUE *argv, VALUE self) #endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_st); +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_st); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); + rb_obj_call_init(vresult, argc, argv); #endif - return vresult; - } - + return vresult; +} + SWIGINTERN VALUE _wrap_new_MemcachedSt(int argc, VALUE *argv, VALUE self) { @@ -10265,7 +10458,7 @@ _wrap_MemcachedResultSt_value_get(int argc, VALUE *argv, VALUE self) { } arg1 = (struct memcached_result_st *)(argp1); result = ((arg1)->value); - vresult = SWIG_NewPointerObj((memcached_string_st *)memcpy((memcached_string_st *)malloc(sizeof(memcached_string_st)),&result,sizeof(memcached_string_st)), SWIGTYPE_p_memcached_string_st, SWIG_POINTER_OWN | 0 ); + vresult = SWIG_NewPointerObj((memcached_string_st *)memcpy((memcached_string_st *)calloc(1,sizeof(memcached_string_st)),&result,sizeof(memcached_string_st)), SWIGTYPE_p_memcached_string_st, SWIG_POINTER_OWN | 0 ); return vresult; fail: return Qnil; @@ -10275,7 +10468,7 @@ _wrap_MemcachedResultSt_value_get(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_MemcachedResultSt_key_set(int argc, VALUE *argv, VALUE self) { struct memcached_result_st *arg1 = (struct memcached_result_st *) 0 ; - char *arg2 ; + char *arg2 = (char *) (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[251] ; @@ -10320,9 +10513,9 @@ _wrap_MemcachedResultSt_key_get(int argc, VALUE *argv, VALUE self) { arg1 = (struct memcached_result_st *)(argp1); result = (char *)(char *) ((arg1)->key); { - size_t size = 251; + size_t size = SWIG_strnlen(result, 251); + - while (size && (result[size - 1] == '\0')) --size; vresult = SWIG_FromCharPtrAndSize(result, size); } @@ -10332,22 +10525,20 @@ _wrap_MemcachedResultSt_key_get(int argc, VALUE *argv, VALUE self) { } -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE -_wrap_MemcachedResultSt_allocate(VALUE self) { +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_MemcachedResultSt_allocate(VALUE self) #else - SWIGINTERN VALUE - _wrap_MemcachedResultSt_allocate(int argc, VALUE *argv, VALUE self) { +_wrap_MemcachedResultSt_allocate(int argc, VALUE *argv, VALUE self) #endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_result_st); +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_result_st); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); + rb_obj_call_init(vresult, argc, argv); #endif - return vresult; - } - + return vresult; +} + SWIGINTERN VALUE _wrap_new_MemcachedResultSt(int argc, VALUE *argv, VALUE self) { @@ -10365,7 +10556,8 @@ _wrap_new_MemcachedResultSt(int argc, VALUE *argv, VALUE self) { SWIGINTERN void -free_memcached_result_st(struct memcached_result_st *arg1) { +free_memcached_result_st(void *self) { + struct memcached_result_st *arg1 = (struct memcached_result_st *)self; free((char *) arg1); } @@ -11309,10 +11501,10 @@ _wrap_MemcachedServerSt_read_ptr_set(int argc, VALUE *argv, VALUE self) { SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","read_ptr", 2, argv[0] )); } arg2 = (char *)(buf2); - if (arg1->read_ptr) free((char*)arg1->read_ptr); + free((char*)arg1->read_ptr); if (arg2) { size_t size = strlen((const char *)(arg2)) + 1; - arg1->read_ptr = (char *)(char *)memcpy((char *)malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); + arg1->read_ptr = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); } else { arg1->read_ptr = 0; } @@ -11371,10 +11563,10 @@ _wrap_MemcachedServerSt_cached_server_error_set(int argc, VALUE *argv, VALUE sel SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","cached_server_error", 2, argv[0] )); } arg2 = (char *)(buf2); - if (arg1->cached_server_error) free((char*)arg1->cached_server_error); + free((char*)arg1->cached_server_error); if (arg2) { size_t size = strlen((const char *)(arg2)) + 1; - arg1->cached_server_error = (char *)(char *)memcpy((char *)malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); + arg1->cached_server_error = (char *)(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); } else { arg1->cached_server_error = 0; } @@ -11641,7 +11833,7 @@ _wrap_MemcachedServerSt_next_retry_set(int argc, VALUE *argv, VALUE self) { if (NIL_P(argv[0])) arg2 = (time_t)-1; else - arg2 = NUM2LONG(rb_funcall(argv[0], rb_intern("tv_sec"), 0)); + arg2 = NUM2LONG(rb_funcall2(argv[0], rb_intern("tv_sec"), 0, 0)); } if (arg1) (arg1)->next_retry = arg2; return Qnil; @@ -11793,7 +11985,7 @@ _wrap_MemcachedServerSt_limit_maxbytes_get(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_MemcachedServerSt_read_buffer_set(int argc, VALUE *argv, VALUE self) { struct memcached_server_st *arg1 = (struct memcached_server_st *) 0 ; - char *arg2 ; + char *arg2 = (char *) (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[8196] ; @@ -11838,9 +12030,9 @@ _wrap_MemcachedServerSt_read_buffer_get(int argc, VALUE *argv, VALUE self) { arg1 = (struct memcached_server_st *)(argp1); result = (char *)(char *) ((arg1)->read_buffer); { - size_t size = 8196; + size_t size = SWIG_strnlen(result, 8196); + - while (size && (result[size - 1] == '\0')) --size; vresult = SWIG_FromCharPtrAndSize(result, size); } @@ -11853,7 +12045,7 @@ _wrap_MemcachedServerSt_read_buffer_get(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_MemcachedServerSt_write_buffer_set(int argc, VALUE *argv, VALUE self) { struct memcached_server_st *arg1 = (struct memcached_server_st *) 0 ; - char *arg2 ; + char *arg2 = (char *) (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[8196] ; @@ -11898,9 +12090,9 @@ _wrap_MemcachedServerSt_write_buffer_get(int argc, VALUE *argv, VALUE self) { arg1 = (struct memcached_server_st *)(argp1); result = (char *)(char *) ((arg1)->write_buffer); { - size_t size = 8196; + size_t size = SWIG_strnlen(result, 8196); + - while (size && (result[size - 1] == '\0')) --size; vresult = SWIG_FromCharPtrAndSize(result, size); } @@ -11913,7 +12105,7 @@ _wrap_MemcachedServerSt_write_buffer_get(int argc, VALUE *argv, VALUE self) { SWIGINTERN VALUE _wrap_MemcachedServerSt_hostname_set(int argc, VALUE *argv, VALUE self) { struct memcached_server_st *arg1 = (struct memcached_server_st *) 0 ; - char *arg2 ; + char *arg2 = (char *) (char *)0 ; void *argp1 = 0 ; int res1 = 0 ; char temp2[64] ; @@ -11958,9 +12150,9 @@ _wrap_MemcachedServerSt_hostname_get(int argc, VALUE *argv, VALUE self) { arg1 = (struct memcached_server_st *)(argp1); result = (char *)(char *) ((arg1)->hostname); { - size_t size = 64; + size_t size = SWIG_strnlen(result, 64); + - while (size && (result[size - 1] == '\0')) --size; vresult = SWIG_FromCharPtrAndSize(result, size); } @@ -11970,22 +12162,20 @@ _wrap_MemcachedServerSt_hostname_get(int argc, VALUE *argv, VALUE self) { } -#ifdef HAVE_RB_DEFINE_ALLOC_FUNC SWIGINTERN VALUE -_wrap_MemcachedServerSt_allocate(VALUE self) { +#ifdef HAVE_RB_DEFINE_ALLOC_FUNC +_wrap_MemcachedServerSt_allocate(VALUE self) #else - SWIGINTERN VALUE - _wrap_MemcachedServerSt_allocate(int argc, VALUE *argv, VALUE self) { +_wrap_MemcachedServerSt_allocate(int argc, VALUE *argv, VALUE self) #endif - - - VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_server_st); +{ + VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_memcached_server_st); #ifndef HAVE_RB_DEFINE_ALLOC_FUNC - rb_obj_call_init(vresult, argc, argv); + rb_obj_call_init(vresult, argc, argv); #endif - return vresult; - } - + return vresult; +} + SWIGINTERN VALUE _wrap_new_MemcachedServerSt(int argc, VALUE *argv, VALUE self) { @@ -13046,27 +13236,27 @@ _wrap_memcached_generate_hash_rvalue(int argc, VALUE *argv, VALUE self) { static swig_type_info _swigt__p_addrinfo = {"_p_addrinfo", "struct addrinfo *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_int32_t = {"_p_int32_t", "int32_t *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_analysis_st = {"_p_memcached_analysis_st", "memcached_analysis_st *|struct memcached_analysis_st *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_behavior = {"_p_memcached_behavior", "enum memcached_behavior *|memcached_behavior *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_callback = {"_p_memcached_callback", "enum memcached_callback *|memcached_callback *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_analysis_st = {"_p_memcached_analysis_st", "struct memcached_analysis_st *|memcached_analysis_st *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_behavior = {"_p_memcached_behavior", "memcached_behavior *|enum memcached_behavior *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_callback = {"_p_memcached_callback", "memcached_callback *|enum memcached_callback *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_calloc_function = {"_p_memcached_calloc_function", "memcached_calloc_function *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_cleanup_func = {"_p_memcached_cleanup_func", "memcached_cleanup_func *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_clone_func = {"_p_memcached_clone_func", "memcached_clone_func *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_connection = {"_p_memcached_connection", "enum memcached_connection *|memcached_connection *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_connection = {"_p_memcached_connection", "memcached_connection *|enum memcached_connection *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_continuum_item_st = {"_p_memcached_continuum_item_st", "memcached_continuum_item_st *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_dump_func = {"_p_memcached_dump_func", "memcached_dump_func *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_execute_function = {"_p_memcached_execute_function", "memcached_execute_function *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_free_function = {"_p_memcached_free_function", "memcached_free_function *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_hash = {"_p_memcached_hash", "enum memcached_hash *|memcached_hash *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_hash = {"_p_memcached_hash", "memcached_hash *|enum memcached_hash *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_malloc_function = {"_p_memcached_malloc_function", "memcached_malloc_function *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_realloc_function = {"_p_memcached_realloc_function", "memcached_realloc_function *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_result_st = {"_p_memcached_result_st", "memcached_result_st *|struct memcached_result_st *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_return = {"_p_memcached_return", "enum memcached_return *|memcached_return *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_server_distribution = {"_p_memcached_server_distribution", "enum memcached_server_distribution *|memcached_server_distribution *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_result_st = {"_p_memcached_result_st", "struct memcached_result_st *|memcached_result_st *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_return = {"_p_memcached_return", "memcached_return *|enum memcached_return *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_server_distribution = {"_p_memcached_server_distribution", "memcached_server_distribution *|enum memcached_server_distribution *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_server_function = {"_p_memcached_server_function", "memcached_server_function *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_server_st = {"_p_memcached_server_st", "memcached_server_st *|struct memcached_server_st *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_st = {"_p_memcached_st", "memcached_st *|struct memcached_st *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_memcached_stat_st = {"_p_memcached_stat_st", "memcached_stat_st *|struct memcached_stat_st *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_server_st = {"_p_memcached_server_st", "struct memcached_server_st *|memcached_server_st *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_st = {"_p_memcached_st", "struct memcached_st *|memcached_st *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_memcached_stat_st = {"_p_memcached_stat_st", "struct memcached_stat_st *|memcached_stat_st *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_string_st = {"_p_memcached_string_st", "memcached_string_st *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_trigger_delete_key = {"_p_memcached_trigger_delete_key", "memcached_trigger_delete_key *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_memcached_trigger_key = {"_p_memcached_trigger_key", "memcached_trigger_key *", 0, 0, (void*)0, 0}; @@ -13188,18 +13378,18 @@ static swig_cast_info *swig_cast_initial[] = { /* ----------------------------------------------------------------------------- * Type initialization: - * This problem is tough by the requirement that no dynamic - * memory is used. Also, since swig_type_info structures store pointers to + * This problem is tough by the requirement that no dynamic + * memory is used. Also, since swig_type_info structures store pointers to * swig_cast_info structures and swig_cast_info structures store pointers back - * to swig_type_info structures, we need some lookup code at initialization. - * The idea is that swig generates all the structures that are needed. - * The runtime then collects these partially filled structures. - * The SWIG_InitializeModule function takes these initial arrays out of + * to swig_type_info structures, we need some lookup code at initialization. + * The idea is that swig generates all the structures that are needed. + * The runtime then collects these partially filled structures. + * The SWIG_InitializeModule function takes these initial arrays out of * swig_module, and does all the lookup, filling in the swig_module.types * array with the correct data and linking the correct swig_cast_info * structures together. * - * The generated swig_type_info structures are assigned staticly to an initial + * The generated swig_type_info structures are assigned statically to an initial * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the @@ -13209,17 +13399,17 @@ static swig_cast_info *swig_cast_initial[] = { * a column is one of the swig_cast_info structures for that type. * The cast_initial array is actually an array of arrays, because each row has * a variable number of columns. So to actually build the cast linked list, - * we find the array of casts associated with the type, and loop through it + * we find the array of casts associated with the type, and loop through it * adding the casts to the list. The one last trick we need to do is making * sure the type pointer in the swig_cast_info struct is correct. * - * First off, we lookup the cast->type name to see if it is already loaded. + * First off, we lookup the cast->type name to see if it is already loaded. * There are three cases to handle: * 1) If the cast->type has already been loaded AND the type we are adding * casting info to has not been loaded (it is in this module), THEN we * replace the cast->type pointer with the type pointer that has already * been loaded. - * 2) If BOTH types (the one we are adding casting info to, and the + * 2) If BOTH types (the one we are adding casting info to, and the * cast->type) are loaded, THEN the cast info has already been loaded by * the previous module so we just ignore it. * 3) Finally, if cast->type has not already been loaded, then we add that @@ -13238,12 +13428,15 @@ extern "C" { #define SWIGRUNTIME_DEBUG #endif +#ifndef SWIG_INIT_CLIENT_DATA_TYPE +#define SWIG_INIT_CLIENT_DATA_TYPE void * +#endif SWIGRUNTIME void -SWIG_InitializeModule(void *clientdata) { +SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) { size_t i; swig_module_info *module_head, *iter; - int found, init; + int init; /* check to see if the circular list has been setup, if not, set it up */ if (swig_module.next==0) { @@ -13262,27 +13455,23 @@ SWIG_InitializeModule(void *clientdata) { /* This is the first module loaded for this interpreter */ /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; iter=module_head; do { if (iter==&swig_module) { - found=1; - break; + /* Our module is already in the list, so there's nothing more to do. */ + return; } iter=iter->next; } while (iter!= module_head); - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ + /* otherwise we must add our module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; } - /* When multiple interpeters are used, a module could have already been initialized in + /* When multiple interpreters are used, a module could have already been initialized in a different interpreter, but not yet have a pointer in this interpreter. In this case, we do not want to continue adding types... everything should be set up already */ @@ -13290,15 +13479,15 @@ SWIG_InitializeModule(void *clientdata) { /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: size %d\n", swig_module.size); + printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size); #endif for (i = 0; i < swig_module.size; ++i) { swig_type_info *type = 0; swig_type_info *ret; swig_cast_info *cast; - + #ifdef SWIGRUNTIME_DEBUG - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); #endif /* if there is another module already loaded */ @@ -13323,7 +13512,7 @@ SWIG_InitializeModule(void *clientdata) { /* Insert casting types */ cast = swig_module.cast_initial[i]; while (cast->type) { - + /* Don't need to add information already in the list */ ret = 0; #ifdef SWIGRUNTIME_DEBUG @@ -13374,7 +13563,7 @@ SWIG_InitializeModule(void *clientdata) { for (i = 0; i < swig_module.size; ++i) { int j = 0; swig_cast_info *cast = swig_module.cast_initial[i]; - printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name); + printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name); while (cast->type) { printf("SWIG_InitializeModule: cast type %s\n", cast->type->name); cast++; @@ -13542,6 +13731,8 @@ SWIGEXPORT void Init_rlibmemcached(void) { rb_define_method(SwigClassMemcachedSt.klass, "snd_timeout", _wrap_MemcachedSt_snd_timeout_get, -1); rb_define_method(SwigClassMemcachedSt.klass, "rcv_timeout=", _wrap_MemcachedSt_rcv_timeout_set, -1); rb_define_method(SwigClassMemcachedSt.klass, "rcv_timeout", _wrap_MemcachedSt_rcv_timeout_get, -1); + rb_define_method(SwigClassMemcachedSt.klass, "poll_max_retries=", _wrap_MemcachedSt_poll_max_retries_set, -1); + rb_define_method(SwigClassMemcachedSt.klass, "poll_max_retries", _wrap_MemcachedSt_poll_max_retries_get, -1); rb_define_method(SwigClassMemcachedSt.klass, "server_failure_limit=", _wrap_MemcachedSt_server_failure_limit_set, -1); rb_define_method(SwigClassMemcachedSt.klass, "server_failure_limit", _wrap_MemcachedSt_server_failure_limit_get, -1); rb_define_method(SwigClassMemcachedSt.klass, "io_msg_watermark=", _wrap_MemcachedSt_io_msg_watermark_set, -1); diff --git a/lib/memcached/version.rb b/lib/memcached/version.rb index 02effe62..3dd1cfd6 100644 --- a/lib/memcached/version.rb +++ b/lib/memcached/version.rb @@ -1,3 +1,3 @@ class Memcached - VERSION = '1.8.3' + VERSION = '1.8.4' end diff --git a/memcached.gemspec b/memcached.gemspec index 23d6d196c0eb45717ae9e2f1ceced2d86fda212f..3e4cb8955a0195461e587f5dd7e48beccb0460a3 100644 GIT binary patch delta 56 ycmZol|B}98h0$aIW3I^tMiT7hsYykd$=Q