From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS60404 5.2.64.0/20 X-Spam-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_ZBI,RCVD_IN_XBL,RDNS_NONE,SPF_FAIL, SPF_HELO_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from 80x24.org (unknown [5.2.75.25]) by dcvr.yhbt.net (Postfix) with ESMTP id 28FF32027C for ; Fri, 3 Mar 2017 20:53:30 +0000 (UTC) From: Eric Wong To: kcar-public@bogomips.org Subject: [PATCH 3/5] drop rb_str_set_len compatibility replacement Date: Fri, 3 Mar 2017 20:53:05 +0000 Message-Id: <20170303205307.2275-4-e@80x24.org> In-Reply-To: <20170303205307.2275-1-e@80x24.org> References: <20170303205307.2275-1-e@80x24.org> List-Id: 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+, and we'll be requiring Ruby 1.9.3+ in the future (and even Ruby 2.2 is EOL nowadays) --- ext/kcar/ext_help.h | 20 -------------------- ext/kcar/extconf.rb | 1 - 2 files changed, 21 deletions(-) diff --git a/ext/kcar/ext_help.h b/ext/kcar/ext_help.h index ec081e2..d227737 100644 --- a/ext/kcar/ext_help.h +++ b/ext/kcar/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/kcar/extconf.rb b/ext/kcar/extconf.rb index 4f19c4a..3585125 100644 --- a/ext/kcar/extconf.rb +++ b/ext/kcar/extconf.rb @@ -5,7 +5,6 @@ dir_config("kcar") have_macro("SIZEOF_OFF_T", "ruby.h") or check_sizeof("off_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_modify", "ruby.h") # -fPIC is needed for Rubinius, MRI already uses it regardless -- EW