argpar: sync with upstream - adjust to iterator API
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 20 Aug 2021 18:39:20 +0000 (14:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 16 Dec 2021 00:10:16 +0000 (19:10 -0500)
Sync with commit 143cec42e14e ("Force usage of ARGPAR_ASSERT() condition
when NDEBUG is defined").

The main change in this sync is the API that changed from
parse-all-at-once (the `argpar_parse` function) to something based on an
iterator, where we need to call `argpar_iter_next` to obtain the next
item.  This was prototyped here (in lttng-tools), so this patch converts
the code to the API that was actually implemented in upstream argpar.

A difference between what we had and the current argpar API is that
argpar does not provide a formatted error string anymore.  It provides
an `argpar_error` object contaning all the raw information needed to
create such string.  The new `format_arg_error_v` function formats the
errors using the exact same syntax as argpar did, such that no changes
in the tests are necessary.

The new `parse_next_item` function factors out the code around calling
argpar_iter_next that would otherwise be duplicated at a few places.

These two new functions are placed into a new `argpar-utils` convenience
library.  I originally put them in the `libcommon.la` convenience
library, but that caused some parts of the code that don't do any
argument parsing (e.g. liblttng-ctl) to have to be linked against
argpar.  As a separate library, we can limit that to just the `lttng`
binary.

Change-Id: I94aa90ffcd93f52b6073c4cd7caca78cfd0f2e05
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>

No differences found
This page took 0.028141 seconds and 4 git commands to generate.