Skip to content

Commit

Permalink
http: cleanups for latest Rubinius
Browse files Browse the repository at this point in the history
Rubinius now supports rb_str_set_len() and sets -fPIC.

We shouldn't check for rb_str_modify() since link-time detection
is broken under Rubinius and even 1.8.6 has rb_str_modify().
  • Loading branch information
Eric Wong committed Jun 10, 2010
1 parent 25bfeb8 commit 5e8979a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions ext/unicorn_http/ext_help.h
Expand Up @@ -10,22 +10,18 @@

#ifndef RUBINIUS
# define rb_str_update(x) do {} while (0)
# define rb_str_flush(x) do {} while (0)
#endif /* !RUBINIUS */

#ifndef HAVE_RB_STR_SET_LEN
# ifdef RUBINIUS
# define rb_str_set_len(str,len) rb_str_resize(str,len)
# else /* 1.8.6 optimized version */
# 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';
rb_str_flush(str);
}
# define rb_str_set_len(str,len) rb_18_str_set_len(str,len)
# endif /* ! RUBINIUS */
#endif /* !defined(HAVE_RB_STR_SET_LEN) */

/* not all Ruby implementations support frozen objects (Rubinius does not) */
Expand Down
6 changes: 1 addition & 5 deletions ext/unicorn_http/extconf.rb
Expand Up @@ -6,9 +6,5 @@
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
with_cflags($CFLAGS + " -fPIC ") do
create_makefile("unicorn_http")
end
create_makefile("unicorn_http")

0 comments on commit 5e8979a

Please sign in to comment.