string-format: introduce function to format a bt_error
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 28 Nov 2019 16:30:03 +0000 (11:30 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 5 Dec 2019 19:29:13 +0000 (19:29 +0000)
commit96c1b5feba1f2193b87bab6c29ba47a1b5edd0b5
tree24954602f8000074db4916fec88721984c59078e
parentec532b44ab55ca6db21780a3f90ed2d6c37eab90
string-format: introduce function to format a bt_error

The CLI has a function to format a bt_error nicely.  We will want to use
it in the Python bindings too, so move it to the string-format
convenience library.  Make it return the formatted string instead of
printing directly to stderr.

I did not try to make this function handle memory allocation errors, as:

1. It's not very likely anyway
2. We are likely in the process of handling an error, I don't think it
   would be useful to return an error code.  If something fails in this
   function, I don't know what else remains to do.

Change-Id: Ia540b95bd9e1aca7899e5fbccfe3fba463457e3c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2433
Tested-by: jenkins <jenkins@lttng.org>
src/cli/babeltrace2.c
src/string-format/Makefile.am
src/string-format/format-error.c [new file with mode: 0644]
src/string-format/format-error.h [new file with mode: 0644]
This page took 0.024636 seconds and 4 git commands to generate.