aboutsummaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-04-22 11:07:35 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-22 16:03:21 -0300
commit5f60bf4eb2ba16e012bb938a2e2b4885445afebc (patch)
tree862c2e23185d39264d9506ba0587b1f78c809c64 /src/os
parent320fade35058202cd094a32612457ba76b524451 (diff)
downloadrneovim-5f60bf4eb2ba16e012bb938a2e2b4885445afebc.tar.gz
rneovim-5f60bf4eb2ba16e012bb938a2e2b4885445afebc.tar.bz2
rneovim-5f60bf4eb2ba16e012bb938a2e2b4885445afebc.zip
Broken build on 32 bit: Fix -Wshorten-64-to-32.
Problem: [ 48%] Building C object src/CMakeFiles/nvim.dir/os/mem.c.o /Users/eliseo/projects/os/neovim/src/os/mem.c:9:32: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'long_u' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32] return uv_get_total_memory() >> 10; ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~ Solution: Avoid conversion. Make function return proper uint64_t. Make users of the function accomodate the value if too big for them.
Diffstat (limited to 'src/os')
-rw-r--r--src/os/mem.c2
-rw-r--r--src/os/os.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/os/mem.c b/src/os/mem.c
index 4eef84bfbe..e5549340ff 100644
--- a/src/os/mem.c
+++ b/src/os/mem.c
@@ -4,7 +4,7 @@
#include "os/os.h"
-long_u os_get_total_mem_kib(void) {
+uint64_t os_get_total_mem_kib(void) {
// Convert bytes to KiB.
return uv_get_total_memory() >> 10;
}
diff --git a/src/os/os.h b/src/os/os.h
index e624f6ac23..67cda28348 100644
--- a/src/os/os.h
+++ b/src/os/os.h
@@ -79,7 +79,7 @@ int os_rmdir(const char *path);
int os_remove(const char *path);
/// Get the total system physical memory in KiB.
-long_u os_get_total_mem_kib(void);
+uint64_t os_get_total_mem_kib(void);
const char *os_getenv(const char *name);
int os_setenv(const char *name, const char *value, int overwrite);
char *os_getenvname_at_index(size_t index);