From: Eric Wong <e@80x24.org>
To: unicorn-public@bogomips.org
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH] drop rb_str_set_len compatibility replacement
Date: Wed, 9 Nov 2016 20:56:41 +0000 [thread overview]
Message-ID: <20161109205641.2350-1-e@80x24.org> (raw)
While it is innocuous after compiling, it can be a confusing
source of errors for users with broken installations of Ruby
itself:
https://bogomips.org/unicorn-public/5ace6a20-e094-293d-93df-b557480e12d5@anyces.com/
https://bogomips.org/unicorn-public/02994a55-9c07-a3c5-f06b-a4c15551a67e@anyces.com/
rb_str_set_len has been provided since Ruby 1.8.7+, so we have
not needed it since we dropped all 1.8.x support in unicorn 5.x.
---
ext/unicorn_http/ext_help.h | 20 --------------------
ext/unicorn_http/extconf.rb | 2 +-
2 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/ext/unicorn_http/ext_help.h b/ext/unicorn_http/ext_help.h
index c87c272..747c36c 100644
--- a/ext/unicorn_http/ext_help.h
+++ b/ext/unicorn_http/ext_help.h
@@ -1,26 +1,6 @@
#ifndef ext_help_h
#define ext_help_h
-#ifndef RSTRING_PTR
-#define RSTRING_PTR(s) (RSTRING(s)->ptr)
-#endif /* !defined(RSTRING_PTR) */
-#ifndef RSTRING_LEN
-#define RSTRING_LEN(s) (RSTRING(s)->len)
-#endif /* !defined(RSTRING_LEN) */
-
-#ifndef HAVE_RB_STR_SET_LEN
-# ifdef RUBINIUS
-# error we should never get here with current Rubinius (1.x)
-# endif
-/* this is taken from Ruby 1.8.7, 1.8.6 may not have it */
-static void rb_18_str_set_len(VALUE str, long len)
-{
- RSTRING(str)->len = len;
- RSTRING(str)->ptr[len] = '\0';
-}
-# define rb_str_set_len(str,len) rb_18_str_set_len(str,len)
-#endif /* !defined(HAVE_RB_STR_SET_LEN) */
-
/* not all Ruby implementations support frozen objects (Rubinius does not) */
#if defined(OBJ_FROZEN)
# define assert_frozen(f) assert(OBJ_FROZEN(f) && "unfrozen object")
diff --git a/ext/unicorn_http/extconf.rb b/ext/unicorn_http/extconf.rb
index 1da0282..2fc60fe 100644
--- a/ext/unicorn_http/extconf.rb
+++ b/ext/unicorn_http/extconf.rb
@@ -4,7 +4,7 @@
have_macro("SIZEOF_OFF_T", "ruby.h") or check_sizeof("off_t", "sys/types.h")
have_macro("SIZEOF_SIZE_T", "ruby.h") or check_sizeof("size_t", "sys/types.h")
have_macro("SIZEOF_LONG", "ruby.h") or check_sizeof("long", "sys/types.h")
-have_func("rb_str_set_len", "ruby.h")
+have_func("rb_str_set_len", "ruby.h") or abort 'Ruby 1.9.3+ required'
have_func("rb_hash_clear", "ruby.h") # Ruby 2.0+
have_func("gmtime_r", "time.h")
--
EW
reply other threads:[~2016-11-09 20:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161109205641.2350-1-e@80x24.org \
--to=e@80x24.org \
--cc=unicorn-public@bogomips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
http://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).