Skip to content

Commit

Permalink
Add Ruby 3.3 compatibility and bump version to 1.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasv committed Feb 6, 2024
1 parent 64be182 commit 827e4d2
Show file tree
Hide file tree
Showing 5 changed files with 673 additions and 476 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.2
3.3.0
8 changes: 7 additions & 1 deletion ext/rlibmemcached.i
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <libmemcached/visibility.h>
#include <libmemcached/memcached.h>
#include <libmemcached/memcached_exist.h>
#include <ruby/version.h>
%}

%warnfilter(SWIGWARN_RUBY_WRONG_NAME) memcached_st;
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 827e4d2

Please sign in to comment.