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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 20 Jan 2020 20:15:24 +0000 (15:15 -0500)
commitbaa9c5f091302dc63d15386e082cabe720d5d84d
treef9c6a08e0fc88b0a9375184d5db957f0db633e7d
parentbed8ebb93ce37f7be10e7968a5f03810de9aa1e2
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.027833 seconds and 4 git commands to generate.