util, buffers: Preparatory improvements
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Jul 2013 17:30:47 +0000 (18:30 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 25 Jul 2013 17:30:47 +0000 (18:30 +0100)
commit28db900b071a43718c4227e759fa76cb8c6359af
tree51ca157ecde5fe9d0f5d4d04d2ea514c6778da86
parent993db2a680648967ff59128c1aa003b9e87c6824
util, buffers: Preparatory improvements

We invent a new kind of buffer_if which is a readonly view of another
block of memory; such a view can be initialised with
buffer_view_readonly or buffer_view_clone.  This makes a convenient
function to allow reparsing a packet, or using the buffer machinery to
parse a particular existing block of memory.

Also, make buffer_assert_free and buffer_assert_used actually call
assert (as well as logging the buffer ownership).  So when these fail
(a) we don't attempt the clean teardown, and (b) we get a core dump if
those are enabled.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
util.c
util.h