summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/curses/curses.c7
-rw-r--r--ext/etc/etc.c7
-rw-r--r--ext/pty/pty.c2
-rw-r--r--ext/sdbm/init.c1
-rw-r--r--ext/socket/socket.c1
-rw-r--r--ext/tk/tkutil.c7
6 files changed, 14 insertions, 11 deletions
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index 5a515275bc..202a0f9244 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -32,7 +32,9 @@
#endif
#endif
+#include "stdio.h"
#include "ruby.h"
+#include "rubyio.h"
static VALUE mCurses;
static VALUE cWindow;
@@ -355,6 +357,7 @@ static VALUE
curses_getch(obj)
VALUE obj;
{
+ rb_read_check(stdin);
return CHR2FIX(getch());
}
@@ -364,6 +367,8 @@ curses_getstr(obj)
VALUE obj;
{
char rtn[1024]; /* This should be big enough.. I hope */
+
+ rb_read_check(stdin);
getstr(rtn);
return rb_tainted_str_new2(rtn);
}
@@ -730,6 +735,7 @@ window_getch(obj)
{
struct windata *winp;
+ rb_read_check(stdin);
GetWINDOW(obj, winp);
return CHR2FIX(wgetch(winp->window));
}
@@ -743,6 +749,7 @@ window_getstr(obj)
char rtn[1024]; /* This should be big enough.. I hope */
GetWINDOW(obj, winp);
+ rb_read_check(stdin);
wgetstr(winp->window, rtn);
return rb_tainted_str_new2(rtn);
}
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index c10680c7d3..271602a294 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -214,10 +214,11 @@ etc_group(obj)
endgrent();
return obj;
}
- return setup_group(getgrent());
-#else
- return Qnil;
+ if (grp = getgrent()) {
+ return setup_group(grp);
+ }
#endif
+ return Qnil;
}
static VALUE mEtc;
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 6462c3c7ca..0438ca7e9b 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -442,12 +442,10 @@ pty_getpty(self, shell)
rfptr->mode = rb_io_mode_flags("r");
rfptr->f = fdopen(info.fd, "r");
rfptr->path = strdup(RSTRING(shell)->ptr);
- rb_obj_call_init((VALUE)rport, 1, &shell);
wfptr->mode = rb_io_mode_flags("w");
wfptr->f = fdopen(dup(info.fd), "w");
wfptr->path = strdup(RSTRING(shell)->ptr);
- rb_obj_call_init((VALUE)wport, 1, &shell);
res = rb_ary_new2(2);
rb_ary_store(res,0,(VALUE)rport);
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index 9ae216193b..5ebffcb9fd 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -85,7 +85,6 @@ fsdbm_s_open(argc, argv, klass)
obj = Data_Make_Struct(klass,struct dbmdata,0,free_sdbm,dbmp);
dbmp->di_dbm = dbm;
dbmp->di_size = -1;
- rb_obj_call_init(obj, argc, argv);
return obj;
}
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 0912ca9dd1..adf622c118 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -114,7 +114,6 @@ sock_new(class, fd)
fp->f2 = rb_fdopen(fd, "w");
fp->mode = FMODE_READWRITE;
rb_io_unbuffered(fp);
- rb_obj_call_init((VALUE)sock, 0, 0);
return (VALUE)sock;
}
diff --git a/ext/tk/tkutil.c b/ext/tk/tkutil.c
index 990c81d724..efa3fd735d 100644
--- a/ext/tk/tkutil.c
+++ b/ext/tk/tkutil.c
@@ -22,14 +22,13 @@ tk_eval_cmd(argc, argv)
}
static VALUE
-tk_s_new(argc, argv, class)
+tk_s_new(argc, argv, klass)
int argc;
VALUE *argv;
- VALUE class;
+ VALUE klass;
{
- VALUE obj = rb_obj_alloc(class);
+ VALUE obj = rb_class_new_instance(argc, argv, klass);
- rb_obj_call_init(obj, argc, argv);
if (rb_iterator_p()) rb_obj_instance_eval(0, 0, obj);
return obj;
}