diff options
author | Ben Smith <binjimin@gmail.com> | 2017-07-14 14:37:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-14 14:37:34 -0700 |
commit | 9e38a8fd3a5bf6022cee56d2e36b57360b026e4a (patch) | |
tree | aff7d691d46d3687a0732082fe87d1e5d1cc47f6 /src/binary-reader-objdump.cc | |
parent | b2194657c4b9b90599ae02b36a02a10dbedc32c4 (diff) | |
download | wabt-9e38a8fd3a5bf6022cee56d2e36b57360b026e4a.tar.gz wabt-9e38a8fd3a5bf6022cee56d2e36b57360b026e4a.tar.bz2 wabt-9e38a8fd3a5bf6022cee56d2e36b57360b026e4a.zip |
Rename read_file -> ReadFile; now returns vector (#572)
This adds the `DataOrNull` function, which is used to get a std::vector
or std::string data(), but return `nullptr` if the container is empty. This
is needed because it is undefined behavior (at least according to ubsan)
if you call `data()` on an empty container.
It would be nicer to have the various read_* functions not take a void*,
size_t pair either, but that's work for another PR (perhaps introducing
a span-like API?)
I've also been considering having ReadFile return a wrapper object
instead, so this could just mmap the file.
Fixes #570.
Diffstat (limited to 'src/binary-reader-objdump.cc')
0 files changed, 0 insertions, 0 deletions