aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memory.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-09-11 04:01:41 +0200
committerJustin M. Keyes <justinkz@gmail.com>2016-09-13 16:20:09 +0200
commitdf072c3b2b20fb7d3d9d50b5ab0df92827aa628f (patch)
treefb80cb1409d60a6316d534b989451cd9986934e6 /src/nvim/memory.c
parent7eb4d2f79dcc712dae1513516b9db5f574d51437 (diff)
downloadrneovim-df072c3b2b20fb7d3d9d50b5ab0df92827aa628f.tar.gz
rneovim-df072c3b2b20fb7d3d9d50b5ab0df92827aa628f.tar.bz2
rneovim-df072c3b2b20fb7d3d9d50b5ab0df92827aa628f.zip
refactor: eliminate misc2.c
move `call_shell` to misc1.c Move some fns to state.c Move some fns to option.c Move some fns to memline.c Move `vim_chdir*` fns to file_search.c Move some fns to new module, bytes.c Move some fns to fileio.c
Diffstat (limited to 'src/nvim/memory.c')
-rw-r--r--src/nvim/memory.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index 8db47b79c1..3e041be4d3 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -440,6 +440,16 @@ void do_outofmem_msg(size_t size)
}
}
+/// Writes time_t to "buf[8]".
+void time_to_bytes(time_t time_, uint8_t buf[8])
+{
+ // time_t can be up to 8 bytes in size, more than uintmax_t in 32 bits
+ // systems, thus we can't use put_bytes() here.
+ for (size_t i = 7, bufi = 0; bufi < 8; i--, bufi++) {
+ buf[bufi] = (uint8_t)((uint64_t)time_ >> (i * 8));
+ }
+}
+
#if defined(EXITFREE)
#include "nvim/file_search.h"