diff options
Diffstat (limited to 'otherlibs/unix')
-rw-r--r-- | otherlibs/unix/access.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/chdir.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/chmod.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/chown.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/chroot.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/getaddrinfo.c | 14 | ||||
-rw-r--r-- | otherlibs/unix/gethost.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/link.c | 4 | ||||
-rw-r--r-- | otherlibs/unix/mkdir.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/mkfifo.c | 4 | ||||
-rw-r--r-- | otherlibs/unix/open.c | 3 | ||||
-rw-r--r-- | otherlibs/unix/opendir.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/readlink.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/rename.c | 4 | ||||
-rw-r--r-- | otherlibs/unix/rmdir.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/stat.c | 8 | ||||
-rw-r--r-- | otherlibs/unix/symlink.c | 4 | ||||
-rw-r--r-- | otherlibs/unix/truncate.c | 4 | ||||
-rw-r--r-- | otherlibs/unix/unlink.c | 2 | ||||
-rw-r--r-- | otherlibs/unix/utimes.c | 4 |
20 files changed, 34 insertions, 37 deletions
diff --git a/otherlibs/unix/access.c b/otherlibs/unix/access.c index 9af8a6f95..7df4f9c5f 100644 --- a/otherlibs/unix/access.c +++ b/otherlibs/unix/access.c @@ -47,7 +47,7 @@ CAMLprim value unix_access(value path, value perms) int ret, cv_flags; cv_flags = convert_flag_list(perms, access_permission_table); - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = access(p, cv_flags); caml_leave_blocking_section(); diff --git a/otherlibs/unix/chdir.c b/otherlibs/unix/chdir.c index 4b93b5fc8..0d5326a0d 100644 --- a/otherlibs/unix/chdir.c +++ b/otherlibs/unix/chdir.c @@ -21,7 +21,7 @@ CAMLprim value unix_chdir(value path) CAMLparam1(path); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = chdir(p); caml_leave_blocking_section(); diff --git a/otherlibs/unix/chmod.c b/otherlibs/unix/chmod.c index a04215521..90dd6024f 100644 --- a/otherlibs/unix/chmod.c +++ b/otherlibs/unix/chmod.c @@ -23,7 +23,7 @@ CAMLprim value unix_chmod(value path, value perm) CAMLparam2(path, perm); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = chmod(p, Int_val(perm)); caml_leave_blocking_section(); diff --git a/otherlibs/unix/chown.c b/otherlibs/unix/chown.c index 0b118fb40..697f44771 100644 --- a/otherlibs/unix/chown.c +++ b/otherlibs/unix/chown.c @@ -21,7 +21,7 @@ CAMLprim value unix_chown(value path, value uid, value gid) CAMLparam1(path); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = chown(p, Int_val(uid), Int_val(gid)); caml_leave_blocking_section(); diff --git a/otherlibs/unix/chroot.c b/otherlibs/unix/chroot.c index 7c9517c11..b41c09ff0 100644 --- a/otherlibs/unix/chroot.c +++ b/otherlibs/unix/chroot.c @@ -21,7 +21,7 @@ CAMLprim value unix_chroot(value path) CAMLparam1(path); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = chroot(p); caml_leave_blocking_section(); diff --git a/otherlibs/unix/getaddrinfo.c b/otherlibs/unix/getaddrinfo.c index cf3bb4a52..28d8903a3 100644 --- a/otherlibs/unix/getaddrinfo.c +++ b/otherlibs/unix/getaddrinfo.c @@ -16,6 +16,7 @@ #include <alloc.h> #include <fail.h> #include <memory.h> +#include <misc.h> #include <signals.h> #include "unixsupport.h" #include "cst2constr.h" @@ -56,27 +57,22 @@ CAMLprim value unix_getaddrinfo(value vnode, value vserv, value vopts) { CAMLparam3(vnode, vserv, vopts); CAMLlocal3(vres, v, e); - mlsize_t len; char * node, * serv; struct addrinfo hints; struct addrinfo * res, * r; int retcode; /* Extract "node" parameter */ - len = string_length(vnode); - if (len == 0) { + if (caml_string_length(vnode) == 0) { node = NULL; } else { - node = caml_stat_alloc(len + 1); - strcpy(node, String_val(vnode)); + node = caml_strdup(String_val(vnode)); } /* Extract "service" parameter */ - len = string_length(vserv); - if (len == 0) { + if (caml_string_length(vserv) == 0) { serv = NULL; } else { - serv = caml_stat_alloc(len + 1); - strcpy(serv, String_val(vserv)); + serv = caml_strdup(String_val(vserv)); } /* Parse options, set hints */ memset(&hints, 0, sizeof(hints)); diff --git a/otherlibs/unix/gethost.c b/otherlibs/unix/gethost.c index 607b6c35f..8d5bb03f5 100644 --- a/otherlibs/unix/gethost.c +++ b/otherlibs/unix/gethost.c @@ -127,7 +127,7 @@ CAMLprim value unix_gethostbyname(value name) char * hostname; #if HAS_GETHOSTBYNAME_R || GETHOSTBYNAME_IS_REENTRANT - hostname = caml_stat_alloc_string(name); + hostname = caml_strdup(String_val(name)); #else hostname = String_val(name); #endif diff --git a/otherlibs/unix/link.c b/otherlibs/unix/link.c index 8110bf583..c71118a59 100644 --- a/otherlibs/unix/link.c +++ b/otherlibs/unix/link.c @@ -22,8 +22,8 @@ CAMLprim value unix_link(value path1, value path2) char * p1; char * p2; int ret; - p1 = caml_stat_alloc_string(path1); - p2 = caml_stat_alloc_string(path2); + p1 = caml_strdup(String_val(path1)); + p2 = caml_strdup(String_val(path2)); caml_enter_blocking_section(); ret = link(p1, p2); caml_leave_blocking_section(); diff --git a/otherlibs/unix/mkdir.c b/otherlibs/unix/mkdir.c index 6a7bb18c2..d72a066c5 100644 --- a/otherlibs/unix/mkdir.c +++ b/otherlibs/unix/mkdir.c @@ -23,7 +23,7 @@ CAMLprim value unix_mkdir(value path, value perm) CAMLparam2(path, perm); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = mkdir(p, Int_val(perm)); caml_leave_blocking_section(); diff --git a/otherlibs/unix/mkfifo.c b/otherlibs/unix/mkfifo.c index ef440a25b..a00bcf2d0 100644 --- a/otherlibs/unix/mkfifo.c +++ b/otherlibs/unix/mkfifo.c @@ -26,7 +26,7 @@ CAMLprim value unix_mkfifo(value path, value mode) CAMLparam2(path, mode); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = mkfifo(p, Int_val(mode)); caml_leave_blocking_section(); @@ -48,7 +48,7 @@ CAMLprim value unix_mkfifo(value path, value mode) CAMLparam2(path, mode); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = mknod(p, (Int_val(mode) & 07777) | S_IFIFO, 0); caml_leave_blocking_section(); diff --git a/otherlibs/unix/open.c b/otherlibs/unix/open.c index c98819aab..32c332f23 100644 --- a/otherlibs/unix/open.c +++ b/otherlibs/unix/open.c @@ -14,6 +14,7 @@ #include <mlvalues.h> #include <alloc.h> #include <memory.h> +#include <misc.h> #include <signals.h> #include "unixsupport.h" #include <string.h> @@ -62,7 +63,7 @@ CAMLprim value unix_open(value path, value flags, value perm) char * p; cv_flags = convert_flag_list(flags, open_flag_table); - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); /* open on a named FIFO can block (PR#1533) */ enter_blocking_section(); fd = open(p, cv_flags, Int_val(perm)); diff --git a/otherlibs/unix/opendir.c b/otherlibs/unix/opendir.c index 57a331888..9cb6829cd 100644 --- a/otherlibs/unix/opendir.c +++ b/otherlibs/unix/opendir.c @@ -30,7 +30,7 @@ CAMLprim value unix_opendir(value path) value res; char * p; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); d = opendir(p); caml_leave_blocking_section(); diff --git a/otherlibs/unix/readlink.c b/otherlibs/unix/readlink.c index d129aebfe..5706ba035 100644 --- a/otherlibs/unix/readlink.c +++ b/otherlibs/unix/readlink.c @@ -36,7 +36,7 @@ CAMLprim value unix_readlink(value path) char buffer[PATH_MAX]; int len; char * p; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); len = readlink(p, buffer, sizeof(buffer) - 1); caml_leave_blocking_section(); diff --git a/otherlibs/unix/rename.c b/otherlibs/unix/rename.c index e63a06e36..78da70948 100644 --- a/otherlibs/unix/rename.c +++ b/otherlibs/unix/rename.c @@ -23,8 +23,8 @@ CAMLprim value unix_rename(value path1, value path2) char * p1; char * p2; int ret; - p1 = caml_stat_alloc_string(path1); - p2 = caml_stat_alloc_string(path2); + p1 = caml_strdup(String_val(path1)); + p2 = caml_strdup(String_val(path2)); caml_enter_blocking_section(); ret = rename(p1, p2); caml_leave_blocking_section(); diff --git a/otherlibs/unix/rmdir.c b/otherlibs/unix/rmdir.c index 28cef33d8..12d521a72 100644 --- a/otherlibs/unix/rmdir.c +++ b/otherlibs/unix/rmdir.c @@ -21,7 +21,7 @@ CAMLprim value unix_rmdir(value path) CAMLparam1(path); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = rmdir(p); caml_leave_blocking_section(); diff --git a/otherlibs/unix/stat.c b/otherlibs/unix/stat.c index 9825802a0..f6d8c06d3 100644 --- a/otherlibs/unix/stat.c +++ b/otherlibs/unix/stat.c @@ -75,7 +75,7 @@ CAMLprim value unix_stat(value path) int ret; struct stat buf; char * p; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = stat(p, &buf); caml_leave_blocking_section(); @@ -92,7 +92,7 @@ CAMLprim value unix_lstat(value path) int ret; struct stat buf; char * p; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); #ifdef HAS_SYMLINK ret = lstat(p, &buf); @@ -126,7 +126,7 @@ CAMLprim value unix_stat_64(value path) int ret; struct stat buf; char * p; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = stat(p, &buf); caml_leave_blocking_section(); @@ -141,7 +141,7 @@ CAMLprim value unix_lstat_64(value path) int ret; struct stat buf; char * p; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); #ifdef HAS_SYMLINK ret = lstat(p, &buf); diff --git a/otherlibs/unix/symlink.c b/otherlibs/unix/symlink.c index 41ba02019..d1dbf37c5 100644 --- a/otherlibs/unix/symlink.c +++ b/otherlibs/unix/symlink.c @@ -25,8 +25,8 @@ CAMLprim value unix_symlink(value path1, value path2) char * p1; char * p2; int ret; - p1 = caml_stat_alloc_string(path1); - p2 = caml_stat_alloc_string(path2); + p1 = caml_strdup(String_val(path1)); + p2 = caml_strdup(String_val(path2)); caml_enter_blocking_section(); ret = symlink(p1, p2); caml_leave_blocking_section(); diff --git a/otherlibs/unix/truncate.c b/otherlibs/unix/truncate.c index c5b3a1159..520320ebb 100644 --- a/otherlibs/unix/truncate.c +++ b/otherlibs/unix/truncate.c @@ -29,7 +29,7 @@ CAMLprim value unix_truncate(value path, value len) CAMLparam2(path, len); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = truncate(p, Long_val(len)); caml_leave_blocking_section(); @@ -45,7 +45,7 @@ CAMLprim value unix_truncate_64(value path, value vlen) char * p; int ret; file_offset len = File_offset_val(vlen); - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = truncate(p, len); caml_leave_blocking_section(); diff --git a/otherlibs/unix/unlink.c b/otherlibs/unix/unlink.c index 4a4a513e3..ae63f69a1 100644 --- a/otherlibs/unix/unlink.c +++ b/otherlibs/unix/unlink.c @@ -21,7 +21,7 @@ CAMLprim value unix_unlink(value path) CAMLparam1(path); char * p; int ret; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = unlink(p); caml_leave_blocking_section(); diff --git a/otherlibs/unix/utimes.c b/otherlibs/unix/utimes.c index bb84c43e5..0c3b77d1b 100644 --- a/otherlibs/unix/utimes.c +++ b/otherlibs/unix/utimes.c @@ -38,7 +38,7 @@ CAMLprim value unix_utimes(value path, value atime, value mtime) t = × else t = (struct utimbuf *) NULL; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = utime(p, t); caml_leave_blocking_section(); @@ -70,7 +70,7 @@ CAMLprim value unix_utimes(value path, value atime, value mtime) t = tv; else t = (struct timeval *) NULL; - p = caml_stat_alloc_string(path); + p = caml_strdup(String_val(path)); caml_enter_blocking_section(); ret = utimes(p, t); caml_leave_blocking_section(); |