cmdline: make struct rdline opaque
authorDmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Thu, 7 Oct 2021 22:10:28 +0000 (01:10 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 22 Oct 2021 21:23:45 +0000 (23:23 +0200)
commitf8f8dc289095ebecff2695efd1350ca6c4dede84
tree03e833a4e7002a58ff975f5bfbebc333041a4adf
parentf43809d28c0b9e7b71afcde56a60fa578a4a7b5f
cmdline: make struct rdline opaque

Hide struct rdline definition and some RDLINE_* constants in order
to be able to change internal buffer sizes transparently to the user.
Add new functions:

* rdline_new(): allocate and initialize struct rdline.
  This function replaces rdline_init() and takes an extra parameter:
  opaque user data for the callbacks.
* rdline_free(): deallocate struct rdline.
* rdline_get_history_buffer_size(): for use in tests.
* rdline_get_opaque(): to obtain user data in callback functions.

Remove rdline_init() function from library headers and export list,
because using it requires the knowledge of sizeof(struct rdline).

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
app/test-cmdline/commands.c
app/test/test_cmdline_lib.c
doc/guides/rel_notes/release_21_11.rst
lib/cmdline/cmdline.c
lib/cmdline/cmdline_private.h
lib/cmdline/cmdline_rdline.c
lib/cmdline/cmdline_rdline.h
lib/cmdline/version.map