diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/extmk.rb.in | 24 | ||||
-rw-r--r-- | ext/kconv/kconv.c | 9 |
2 files changed, 27 insertions, 6 deletions
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 0c32954577..e0f16e116c 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -93,6 +93,24 @@ def try_cpp xsystem(format(CPP, $CFLAGS)) end +def install_rb(mfile) + path = [] + dir = [] + Find.find("lib") do |f| + next unless /\.rb$/ =~ f + f = f[4..-1] + path.push f + dir |= File.dirname(f) + end + for f in dir + next if f == "." + mfile.printf "\t@test -d $(libdir)/%s || mkdir $(libdir)/%s\n", f, f + end + for f in path + mfile.printf "\t$(INSTALL_DATA) %s $(libdir)/%s\n", f, f + end +end + def have_library(lib, func) if $lib_cache[lib] if $lib_cache[lib] == "yes" @@ -304,16 +322,14 @@ realclean: clean mfile.printf "\ install: + @test -d $(libdir) || mkdir $(libdir) " if !$static mfile.printf "\ - @test -d $(libdir) || mkdir $(libdir) $(INSTALL) $(TARGET) $(libdir)/$(TARGET) " end - for rb in Dir["lib/*.rb"] - mfile.printf "\t$(INSTALL_DATA) %s @libdir@/$(RUBY_INSTALL_NAME)\n", rb - end + install_rb(mfile) mfile.printf "\n" if !$static && "@DLEXT@" != "o" diff --git a/ext/kconv/kconv.c b/ext/kconv/kconv.c index fb229c6ef6..0cb9b10a0b 100644 --- a/ext/kconv/kconv.c +++ b/ext/kconv/kconv.c @@ -1891,10 +1891,15 @@ static VALUE kconv_guess(obj, src) VALUE obj, src; { - unsigned char *p = RSTRING(src)->ptr; - unsigned char *pend = p + RSTRING(src)->len; + unsigned char *p; + unsigned char *pend; int sequence_counter = 0; + Check_Type(src, T_STRING); + + p = RSTRING(src)->ptr; + pend = p + RSTRING(src)->len; + #define INCR do {\ p++;\ if (p==pend) return INT2FIX(_UNKNOWN);\ |