aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/fs.c
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan991@gmail.com>2014-08-08 16:25:33 +0200
committerStefan Hoffmann <stefan991@gmail.com>2014-08-31 15:15:02 +0200
commitaa378acdf51daf235c7e721cfa646d115d8708f0 (patch)
tree5c02b8599c0fd40daac18b120e819c73e114bbda /src/nvim/os/fs.c
parent3051015f8907445bbb193a0781c75f9cdc54236e (diff)
downloadrneovim-aa378acdf51daf235c7e721cfa646d115d8708f0.tar.gz
rneovim-aa378acdf51daf235c7e721cfa646d115d8708f0.tar.bz2
rneovim-aa378acdf51daf235c7e721cfa646d115d8708f0.zip
fileinfo: implement os_fileinfo_size
this replaces os_get_file_size and file_info.stat.st_size
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r--src/nvim/os/fs.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index aca7005064..9347afb9bc 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -258,20 +258,6 @@ int os_file_is_writable(const char *name)
return 0;
}
-/// Get the size of a file in bytes.
-///
-/// @param[out] size pointer to an off_t to put the size into.
-/// @return `true` for success, `false` for failure.
-bool os_get_file_size(const char *name, off_t *size)
-{
- uv_stat_t statbuf;
- if (os_stat(name, &statbuf)) {
- *size = statbuf.st_size;
- return true;
- }
- return false;
-}
-
/// Rename a file or directory.
///
/// @return `OK` for success, `FAIL` for failure.
@@ -408,6 +394,15 @@ uint64_t os_file_info_get_inode(const FileInfo *file_info)
return file_info->stat.st_ino;
}
+/// Get the size of a file from a `FileInfo`.
+///
+/// @return filesize in bytes.
+off_t os_fileinfo_size(const FileInfo *file_info)
+ FUNC_ATTR_NONNULL_ALL
+{
+ return file_info->stat.st_size;
+}
+
/// Get the `FileID` for a given path
///
/// @param path Path to the file.