- xmallocz() is not static anymore. There are many use cases for this function
in the codebase and we should start using it.
- Simpler types in ga_concat_strings()
There will be more use cases for try_malloc(): see #556.
- Reimplemented xmalloc() using try_malloc().
- verbose_try_malloc() is just like try_malloc() but shows an out-of-memory
error message before returning NULL.
- Let the compiler generate size>>1 assembly for signed types. We're not using
old compilers here.
- Add proper function attributes to the new functions in memory.h
Unfortunately there's still a case where NULL can be returned from
file_pat_to_reg_pat().
xmemdupz() and xmallocz() aren't static anymore. There are many use cases for
these function.
With this, you can now run a single unit test file using:
TEST_FILE=/path/to/file make unittest
For example, to just run the path unit tests, you can do:
TEST_FILE=test/unit/path.moon make unittest
Fix uses of plain "%lu", "%lo", "%lx" and "%lX" within sprintf():
- Replace "%l<whatever>" with "%" PRI<whatever>64.
- Cast corresponding argument to (uint64_t).
Fix uses of localized "%lld" within sprintf():
- Replace _("%lld") with _("%" PRId64).
- Cast corresponding argument to (int64_t).
- In *.po files, replace "%lld" with "%<PRId64>".
- Build targeting 32-bit with travis
- Code in `before_install`/`after_success` was moved to travis.sh since it
provides greater flexibility for detecting the build matrix environment. This
improves the build speed since we now install only what's necessary.
- Now clint has a dedicated travis worker
Problem:
[ 51%] Building C object src/CMakeFiles/nvim.dir/os/rstream.c.o
/Users/eliseo/projects/os/neovim/src/os/rstream.c:237:24: error: comparison of constant
9223372036854775807 with expression of type 'size_t' (aka 'unsigned long') is always true
[-Werror,-Wtautological-constant-out-of-range-compare]
assert(rstream->fpos <= INT64_MAX);
~~~~~~~~~~~~~ ^ ~~~~~~~~~
/usr/include/assert.h:93:25: note: expanded from macro 'assert'
(__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
^
Solution:
Assertion temporarily disabled.
TODO: Review types so that assertion can be used.
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.
There are some systems that have usernames of the form DOMAIN\username,
which causes an invalid escape character to be inserted. I was going to
add some escaping, but decided it would be best to just outright set the
value, since I don't want the DOMAIN portion in there anyways.
I'm not sure whether to go for signed or unsigned types for the offsets, but
without a doubt size_t is a better alternative than uint32_t. Added casts
after checking bounds before and after calling external libraries (in this
case libuv).