summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-18 08:47:06 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-18 08:47:06 +0000
commit35f851bcfe7e42ddf1b44606d2df4d4be9de9976 (patch)
tree22b6a55b921d76a6d432f0a2156496ccb827be73 /ext
parentcd956b3114c1b59de6660e1c70be192c6ee29235 (diff)
* string.c (rb_str_replace): swap arguments of OBJ_INFECT.
* eval.c (rb_thread_schedule): should not select a thread which is not yet initialized. * time.c (time_plus): wrong boundary check. * time.c (time_minus): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/Win32API/Win32API.c12
-rw-r--r--ext/etc/etc.c4
-rw-r--r--ext/socket/socket.c29
-rw-r--r--ext/syslog/syslog.c2
4 files changed, 23 insertions, 24 deletions
diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c
index 0ee28f05ac..65b6a558c1 100644
--- a/ext/Win32API/Win32API.c
+++ b/ext/Win32API/Win32API.c
@@ -64,8 +64,8 @@ Win32API_initialize(self, dllname, proc, import, export)
int len;
int ex;
- Check_SafeStr(dllname);
- Check_SafeStr(proc);
+ SafeStringValue(dllname);
+ SafeStringValue(proc);
hdll = LoadLibrary(RSTRING(dllname)->ptr);
if (!hdll)
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
@@ -90,7 +90,7 @@ Win32API_initialize(self, dllname, proc, import, export)
case T_ARRAY:
ptr = RARRAY(import)->ptr;
for (i = 0, len = RARRAY(import)->len; i < len; i++) {
- Check_SafeStr(ptr[i]);
+ SafeStringValue(ptr[i]);
switch (*(char *)RSTRING(ptr[i])->ptr) {
case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
@@ -105,7 +105,7 @@ Win32API_initialize(self, dllname, proc, import, export)
}
break;
default:
- Check_SafeStr(import);
+ SafeStringValue(import);
s = RSTRING(import)->ptr;
for (i = 0, len = RSTRING(import)->len; i < len; i++) {
switch (*s++) {
@@ -127,7 +127,7 @@ Win32API_initialize(self, dllname, proc, import, export)
if (NIL_P(export)) {
ex = _T_VOID;
} else {
- Check_SafeStr(export);
+ SafeStringValue(export);
switch (*RSTRING(export)->ptr) {
case 'V': case 'v':
ex = _T_VOID;
@@ -228,7 +228,7 @@ Win32API_Call(argc, argv, obj)
} else if (FIXNUM_P(str)){
pParam = (char *)NUM2ULONG(str);
} else {
- Check_Type(str, T_STRING);
+ StringValue(str);
rb_str_modify(str);
pParam = RSTRING(str)->ptr;
}
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index ee0cd529e4..5c54237b7a 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -117,7 +117,7 @@ etc_getpwnam(obj, nam)
#ifdef HAVE_GETPWENT
struct passwd *pwd;
- Check_Type(nam, T_STRING);
+ StringValue(nam);
pwd = getpwnam(RSTRING(nam)->ptr);
if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %s", RSTRING(nam)->ptr);
return setup_passwd(pwd);
@@ -194,7 +194,7 @@ etc_getgrnam(obj, nam)
#ifdef HAVE_GETGRENT
struct group *grp;
- Check_Type(nam, T_STRING);
+ StringValue(nam);
grp = getgrnam(RSTRING(nam)->ptr);
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", RSTRING(nam)->ptr);
return setup_group(grp);
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index e1f84376aa..48058a32fa 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -561,7 +561,7 @@ ip_addrsetup(host, port)
else {
char *name;
- Check_SafeStr(host);
+ SafeStringValue(host);
name = RSTRING(host)->ptr;
if (*name == 0) {
mkinetaddr(INADDR_ANY, hbuf, sizeof(hbuf));
@@ -793,7 +793,7 @@ load_addr_info(h, serv, type, res)
int error;
if (!NIL_P(h)) {
- Check_SafeStr(h);
+ SafeStringValue(h);
host = RSTRING(h)->ptr;
}
else {
@@ -804,7 +804,7 @@ load_addr_info(h, serv, type, res)
portp = pbuf;
}
else {
- Check_SafeStr(serv);
+ SafeStringValue(serv);
if (RSTRING(serv)->len >= sizeof(pbuf))
rb_raise(rb_eArgError, "servicename too long (%d)", RSTRING(serv)->len);
strcpy(pbuf, RSTRING(serv)->ptr);
@@ -918,10 +918,9 @@ tcp_s_open(argc, argv, class)
&remote_host, &remote_serv,
&local_host, &local_serv);
- Check_SafeStr(remote_host);
-
+ SafeStringValue(remote_host);
if (!NIL_P(local_host)) {
- Check_SafeStr(local_host);
+ SafeStringValue(local_host);
}
return open_inet(class, remote_host, remote_serv,
@@ -940,7 +939,7 @@ socks_s_open(class, host, serv)
init = 1;
}
- Check_SafeStr(host);
+ SafeStringValue(host);
return open_inet(class, host, serv, Qnil, Qnil, INET_SOCKS);
}
@@ -1150,7 +1149,7 @@ tcp_accept(sock)
static VALUE
open_unix(class, path, server)
VALUE class;
- struct RString *path;
+ VALUE path;
int server;
{
struct sockaddr_un sockaddr;
@@ -1158,7 +1157,7 @@ open_unix(class, path, server)
VALUE sock;
OpenFile *fptr;
- Check_SafeStr(path);
+ SafeStringValue(path);
fd = ruby_socket(AF_UNIX, SOCK_STREAM, 0);
if (fd < 0) {
rb_sys_fail("socket(2)");
@@ -1166,7 +1165,7 @@ open_unix(class, path, server)
MEMZERO(&sockaddr, struct sockaddr_un, 1);
sockaddr.sun_family = AF_UNIX;
- strncpy(sockaddr.sun_path, path->ptr, sizeof(sockaddr.sun_path)-1);
+ strncpy(sockaddr.sun_path, RSTRING(path)->ptr, sizeof(sockaddr.sun_path)-1);
sockaddr.sun_path[sizeof(sockaddr.sun_path)-1] = '\0';
if (server) {
@@ -1189,7 +1188,7 @@ open_unix(class, path, server)
sock = sock_new(class, fd);
GetOpenFile(sock, fptr);
- fptr->path = strdup(path->ptr);
+ fptr->path = strdup(RSTRING(path)->ptr);
return sock;
}
@@ -1466,7 +1465,7 @@ setup_domain_and_type(domain, dv, type, tv)
char *ptr;
if (TYPE(domain) == T_STRING) {
- Check_SafeStr(domain);
+ SafeStringValue(domain);
ptr = RSTRING(domain)->ptr;
if (strcmp(ptr, "AF_INET") == 0)
*dv = AF_INET;
@@ -1515,7 +1514,7 @@ setup_domain_and_type(domain, dv, type, tv)
*dv = NUM2INT(domain);
}
if (TYPE(type) == T_STRING) {
- Check_SafeStr(type);
+ SafeStringValue(type);
ptr = RSTRING(type)->ptr;
if (strcmp(ptr, "SOCK_STREAM") == 0)
*tv = SOCK_STREAM;
@@ -1597,7 +1596,7 @@ sock_connect(sock, addr)
OpenFile *fptr;
int fd;
- Check_Type(addr, T_STRING);
+ StringValue(addr);
rb_str_modify(addr);
GetOpenFile(sock, fptr);
@@ -1615,7 +1614,7 @@ sock_bind(sock, addr)
{
OpenFile *fptr;
- Check_Type(addr, T_STRING);
+ StringValue(addr);
rb_str_modify(addr);
GetOpenFile(sock, fptr);
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
index 5bd577caad..43392a3cef 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -62,7 +62,7 @@ static VALUE cSyslog_open(int argc, VALUE *argv, VALUE self)
fac = INT2NUM(LOG_USER);
}
- Check_SafeStr(ident);
+ SafeStringValue(ident);
syslog_ident = ident;
syslog_options = opt;
syslog_facility = fac;