The native buffer of a membuffer is not NUL-terminated, so when you want
to detach it and use it as a C string, you had to first do
'mb_cstring()' that adds the proper termination/
This was all documented in the header files, and all but two users did
it correctly.
But there were those two users, and the exported interface was
unnecessarily hard to use. We do want the "just detach the raw buffer"
internally in the membuffer code, but let's not make the exported
interface be that hard to use.
So this switches the exported interface to be 'detach_cstring()', which
does that 'mb_cstring()' for you, and avoids the possibility that you'd
use a non-terminated memory buffer as a C string.
The old 'detach_buffer()' is now purely the internal membuffer
implementation, and not used by others.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Move the declarations of the "report_error()" and "set_error_cb()"
functions and the "verbose" variable to errorhelper.h.
Thus, error-reporting translation units don't have to import the
big dive.h header file.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Remove a few cases of
void fun() {
...
}
While touching these functions, fix a few other whitespace
coding style violations.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
The function is defined in qthelper.c and thus not all users
of dive.h have to suck in the xslt headers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Remove the global error buffer and pass the error string directly
to the frontend. The frontend is then responsible for accumulating
errors.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>