aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Wienecke <wienecke.t@gmail.com>2014-02-25 17:03:04 +0100
committerThiago de Arruda <tpadilha84@gmail.com>2014-02-25 14:26:21 -0300
commit1e2da25d3da075c87fababccae0c58d6ffa7df21 (patch)
tree0647ea3070cba8936213da6835de260e45920968 /src
parentd342257ae414a98be74b2a58382678eef7249ebc (diff)
downloadrneovim-1e2da25d3da075c87fababccae0c58d6ffa7df21.tar.gz
rneovim-1e2da25d3da075c87fababccae0c58d6ffa7df21.tar.bz2
rneovim-1e2da25d3da075c87fababccae0c58d6ffa7df21.zip
os_unix: Use libuv uv_cwd instead of getcwd/getwd.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c1
-rw-r--r--src/fileio.c1
-rw-r--r--src/mark.c1
-rw-r--r--src/os/fs.c14
-rw-r--r--src/os/os.h1
-rw-r--r--src/os_unix.c18
-rw-r--r--src/proto/os_unix.pro1
-rw-r--r--src/quickfix.c1
8 files changed, 19 insertions, 19 deletions
diff --git a/src/eval.c b/src/eval.c
index 1ad5cf6eae..51519bb899 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -12,6 +12,7 @@
*/
#include "vim.h"
+#include "os/os.h"
diff --git a/src/fileio.c b/src/fileio.c
index e4d261d902..8dc31c31c6 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -12,6 +12,7 @@
*/
#include "vim.h"
+#include "os/os.h"
#if defined(HAVE_UTIME) && defined(HAVE_UTIME_H)
diff --git a/src/mark.c b/src/mark.c
index 67888912d8..52f51b7679 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -12,6 +12,7 @@
*/
#include "vim.h"
+#include "os/os.h"
/*
* This file contains routines to maintain and manipulate marks.
diff --git a/src/os/fs.c b/src/os/fs.c
index 358b07e57b..e9a76c6b79 100644
--- a/src/os/fs.c
+++ b/src/os/fs.c
@@ -23,3 +23,17 @@ int mch_chdir(char *path) {
}
return uv_chdir(path);
}
+
+/*
+ * Get name of current directory into buffer 'buf' of length 'len' bytes.
+ * Return OK for success, FAIL for failure.
+ */
+int mch_dirname(char_u *buf, int len)
+{
+ int errno;
+ if ((errno = uv_cwd((char *)buf, len)) != 0) {
+ STRCPY(buf, uv_strerror(errno));
+ return FAIL;
+ }
+ return OK;
+}
diff --git a/src/os/os.h b/src/os/os.h
index 58d49d36e7..099f53312f 100644
--- a/src/os/os.h
+++ b/src/os/os.h
@@ -5,5 +5,6 @@
long_u mch_total_mem(int special);
int mch_chdir(char *path);
+int mch_dirname(char_u *buf, int len);
#endif
diff --git a/src/os_unix.c b/src/os_unix.c
index f65b285ba7..2bfddafc6c 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1245,24 +1245,6 @@ static char * strerror(int err)
#endif
/*
- * Get name of current directory into buffer 'buf' of length 'len' bytes.
- * Return OK for success, FAIL for failure.
- */
-int mch_dirname(char_u *buf, int len)
-{
-#if defined(USE_GETCWD)
- if (getcwd((char *)buf, len) == NULL) {
- STRCPY(buf, strerror(errno));
- return FAIL;
- }
- return OK;
-#else
- return getwd((char *)buf) != NULL ? OK : FAIL;
-#endif
-}
-
-
-/*
* Get absolute file name into "buf[len]".
*
* return FAIL for failure, OK for success
diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro
index 7c5c62a786..64be80500c 100644
--- a/src/proto/os_unix.pro
+++ b/src/proto/os_unix.pro
@@ -27,7 +27,6 @@ int mch_get_user_name __ARGS((char_u *s, int len));
int mch_get_uname __ARGS((uid_t uid, char_u *s, int len));
void mch_get_host_name __ARGS((char_u *s, int len));
long mch_get_pid __ARGS((void));
-int mch_dirname __ARGS((char_u *buf, int len));
void slash_adjust __ARGS((char_u *p));
int mch_FullName __ARGS((char_u *fname, char_u *buf, int len, int force));
int mch_isFullName __ARGS((char_u *fname));
diff --git a/src/quickfix.c b/src/quickfix.c
index 5fa175c0cb..a141d9834b 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -12,6 +12,7 @@
*/
#include "vim.h"
+#include "os/os.h"
struct dir_stack_T {