channel: fix `REQ` definition for msgpack-rpc logging
msgpack-rpc: Terminate server->client calls when the channel closes
test: Small fixes and improvements to functional helpers.lua

- Move the cleanup function definition into `restart()` so restart can be
  selectively used as a hook
- Improve error handling: Before this, errors while running the event loop would
  cause busted to get stuck. Now the error is properly raised by stopping the
  event loop first.
input: Fix conversion error in `convert_input()`

The `rbuffer_consumed` was being passed a consumed count from another buffer,
causing integer overflow in `rbuffer_relocate`.

Fixes #1343
Merge PR #1354 'Fixes to channel.c, input.c and helpers.lua'
job/valgrind: Fix invalid reads/missing free.

The JobEvent structure may refer to a job after it has been freed. Apply
@tarruda's patch to extract the job data before pushing the event.

Also, fix the type, "data" -> "job", in on_job_exit() and free the job
name in the last job event.
job_start: Do not close in/out/err on error.

The streams job_close_*() reference have not been initialized by the
time we call uv_spawn() and libuv closes these pipes for us when spawn()
fails.
test/shell: Add failure tests for `system()`.
test/job: Implement some basic jobs tests.
Merge PR #1350 'valgrind/jobs: Fix invalid reads.'
memory: implement xmemrchr()
rstream: Expose rstream_read_ptr and _available.

Needed for accessing this information without direct access to the
rstream_buffer.
job: Read job data line-wise.

Only read up to the last newline in push_job_event().
job: Make v:job_data[2] a list.

Factor out string_to_list() from f_system()'s implementation
and use that to set job_data. This has the technical advantage of
preserving NULs, and may be more convenient for users.

Required for #1176.
job: Let vimL jobsend() accept a list.

Use save_tv_as_string(), same as vimL system(). This also makes
jobsend() more liberal in what it can accept. For example,
`jobsend(j, 123)` is now valid.

Closes #1176