8000 several minor fixes. · jruby/ruby@11466a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11466a5

Browse files
author
matz
committed
several minor fixes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_m17n@2626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 7ce7d91 commit 11466a5

File tree

17 files changed

+440
-213
lines changed

17 files changed

+440
-213
lines changed

eval.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,27 +1416,6 @@ ev_const_get(cref, id)
14161416
return rb_const_get(cref->nd_clss, id);
14171417
}
14181418

1419-
static VALUE
1420-
ev_const_set(cref, id, val)
1421-
NODE *cref;
1422-
ID id;
1423-
VALUE val;
1424-
{
1425-
NODE *cbase = cref;
1426-
1427-
while (cbase && cbase->nd_clss != rb_cObject) {
1428-
struct RClass *klass = RCLASS(cbase->nd_clss);
1429-
1430-
if (klass->iv_tbl && st_lookup(klass->iv_tbl, id, 0)) {
1431-
st_insert(klass->iv_tbl, id, val);
1432-
return val;
1433-
}
1434-
cbase = cbase->nd_next;
1435-
}
1436-
rb_const_assign(cbase->nd_clss, id, val);
1437-
return val;
1438-
}
1439-
14401419
static VALUE
14411420
rb_mod_nesting()
14421421
{

ext/dbm/dbm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#ifdef HAVE_SYS_CDEFS_H
1919
# include <sys/cdefs.h>
2020
#endif
21-
#include <ndbm.h>
21+
#include DBM_HDR
2222
#include <fcntl.h>
2323
#include <errno.h>
2424

ext/dbm/extconf.rb

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,56 @@
11
require 'mkmf'
22

33
dir_config("dbm")
4-
if have_library("gdbm", "dbm_open")
5-
gdbm = true
4+
5+
dblib = with_config("dbm-type", nil)
6+
7+
$dbm_conf_headers = {
8+
"db" => ["db.h"],
9+
"db1" => ["db1/ndbm.h", "db1.h", "ndbm.h"],
10+
"db2" => ["db2/db.h", "db2.h", "db.h"],
11+
"dbm" => ["ndbm.h"],
12+
"gdbm" => ["gdbm-ndbm.h", "ndbm.h"],
13+
}
14+
15+
def db_check(db)
16+
$dbm_conf_db_prefix = ""
17+
$dbm_conf_have_gdbm = false
18+
hsearch = ""
19+
20+
case db
21+
when /^db2?$/
22+
$dbm_conf_db_prefix = "__db_n"
23+
hsearch = "-DDB_DBM_HSEARCH "
24+
when "gdbm"
25+
$dbm_conf_have_gdbm = true
26+
end
27+
28+
if have_func(db_prefix("dbm_open")) || have_library(db, db_prefix("dbm_open"))
29+
for hdr in $dbm_conf_headers.fetch(db, ["ndbm.h"])
30+
if have_header(hdr.dup)
31+
$CFLAGS += " " + hsearch + "-DDBM_HDR='<"+hdr+">'"
32+
return true
33+
end
34+
end
35+
end
36+
return false
637
end
7-
gdbm or have_library("db", "dbm_open") or have_library("dbm", "dbm_open")
38+
39+
def db_prefix(func)
40+
$dbm_conf_db_prefix+func
41+
end
42+
43+
if dblib
44+
db_check(dblib)
45+
else
46+
for dblib in %w(db db2 db1 dbm gdbm)
47+
db_check(dblib) and break
48+
end
49+
end
50+
851
have_header("cdefs.h")
952
have_header("sys/cdefs.h")
10-
if have_header("ndbm.h") and have_func("dbm_open")
11-
have_func("dbm_clearerr") unless gdbm
53+
if have_func(db_prefix("dbm_open"))
54+
have_func(db_prefix("dbm_clearerr")) unless $dbm_conf_have_gdbm
1255
create_makefile("dbm")
1356
end

ext/readline/extconf.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@
99
if have_header("readline/readline.h") and
1010
have_header("readline/history.h") and
1111
have_library("readline", "readline")
12+
if have_func("rl_filename_completion_function")
13+
$CFLAGS += "-DREADLINE_42_OR_LATER"
14+
end
1215
create_makefile("readline")
1316
end

ext/readline/readline.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ static VALUE mReadline;
1515
#define COMPLETION_PROC "completion_proc"
1616
#define COMPLETION_CASE_FOLD "completion_case_fold"
1717

18+
#ifndef READLINE_42_OR_LATER
19+
# define rl_filename_completion_function filename_completion_function
20+
# define rl_username_completion_function username_completion_function
21+
# define rl_completion_matches completion_matches
22+
#endif
23+
1824
static int
1925
readline_event()
2026
{
@@ -321,8 +327,8 @@ filename_completion_proc_call(self, str)
321327
char **matches;
322328
int i;
323329

324-
matches = completion_matches(STR2CSTR(str),
325-
filename_completion_function);
330+
matches = rl_completion_matches(STR2CSTR(str),
331+
rl_filename_completion_function);
326332
if (matches) {
327333
result = rb_ary_new();
328334
for (i = 0; matches[i]; i++) {
@@ -348,8 +354,8 @@ username_completion_proc_call(self, str)
348354
char **matches;
349355
int i;
350356

351-
matches = completion_matches(STR2CSTR(str),
352-
username_completion_function);
357+
matches = rl_completion_matches(STR2CSTR(str),
358+
rl_username_completion_function);
353359
if (matches) {
354360
result = rb_ary_new();
355361
for (i = 0; matches[i]; i++) {

intern.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,12 @@ VALUE rb_f_sprintf _((int, VALUE*));
301301
/* string.c */
302302
struct m17n_encoding *ruby_default_encoding;
303303
struct m17n_encoding *rb_m17n_get_encoding _((VALUE obj));
304-
void rb_m17n_associate_encoding _((VALUE obj, struct m17n_encoding* enc));
305-
void rb_m17n_enc_check _((VALUE str1, VALUE str2, struct m17n_encoding **encp));
304+
void rb_m17n_associate_encoding _((VALUE, struct m17n_encoding*));
305+
void rb_m17n_copy_encoding _((VALUE, VALUE));
306+
void rb_m17n_enc_check _((VALUE, VALUE, struct m17n_encoding **));
306307
int rb_str_sublen _((VALUE, int));
307-
VALUE rb_enc_get_encoding _((VALUE obj));
308-
VALUE rb_enc_set_encoding _((VALUE obj, VALUE encoding));
308+
VALUE rb_enc_get_encoding _((VALUE));
309+
VALUE rb_enc_set_encoding _((VALUE, VALUE));
309310
VALUE rb_str_new _((const char*, long));
310311
VALUE rb_str_new2 _((const char*));
311312
VALUE rb_str_new3 _((VALUE));

io.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,10 +1330,10 @@ VALUE
13301330
rb_io_binmode(io)
13311331
VALUE io;
13321332
{
1333-
#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
13341333
OpenFile *fptr;
13351334

13361335
GetOpenFile(io, fptr);
1336+
#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
13371337
#ifdef __human68k__
13381338
if (fptr->f)
13391339
fmode(fptr->f, _IOBIN);
@@ -1348,6 +1348,7 @@ rb_io_binmode(io)
13481348

13491349
fptr->mode |= FMODE_BINMODE;
13501350
#endif
1351+
fptr->enc = m17n_find_encoding("binary");
13511352
return io;
13521353
}
13531354

@@ -1668,8 +1669,8 @@ pipe_open(pname, mode)
16681669
{
16691670
int modef = rb_io_mode_flags(mode);
16701671
OpenFile *fptr;
1671-
16721672
#if defined(NT) || defined(DJGPP) || defined(__human68k__)
1673+
16731674
FILE *f = popen(pname, mode);
16741675

16751676
if (!f) rb_sys_fail(pname);

0 commit comments

Comments
 (0)
0