libpkgconf: fragment: there are no consumers of non-escaped rendered fragment lists, so deprecate the option

pull/164/head
William Pitcock 2017-12-10 00:36:20 -06:00
parent d2b6983385
commit cad2515be5
1 changed files with 13 additions and 7 deletions

View File

@ -508,7 +508,7 @@ static const pkgconf_fragment_render_ops_t default_render_ops = {
* Calculates the required memory to store a `fragment list` when rendered as a string.
*
* :param pkgconf_list_t* list: The `fragment list` being rendered.
* :param bool escape: Whether or not to escape special shell characters.
* :param bool escape: Whether or not to escape special shell characters (deprecated).
* :param pkgconf_fragment_render_ops_t* ops: An optional ops structure to use for custom renderers, else ``NULL``.
* :return: the amount of bytes required to represent the `fragment list` when rendered
* :rtype: size_t
@ -516,8 +516,10 @@ static const pkgconf_fragment_render_ops_t default_render_ops = {
size_t
pkgconf_fragment_render_len(const pkgconf_list_t *list, bool escape, const pkgconf_fragment_render_ops_t *ops)
{
(void) escape;
ops = ops != NULL ? ops : &default_render_ops;
return ops->render_len(list, escape);
return ops->render_len(list, true);
}
/*
@ -530,15 +532,17 @@ pkgconf_fragment_render_len(const pkgconf_list_t *list, bool escape, const pkgco
* :param pkgconf_list_t* list: The `fragment list` being rendered.
* :param char* buf: The buffer to render the fragment list into.
* :param size_t buflen: The length of the buffer.
* :param bool escape: Whether or not to escape special shell characters.
* :param bool escape: Whether or not to escape special shell characters (deprecated).
* :param pkgconf_fragment_render_ops_t* ops: An optional ops structure to use for custom renderers, else ``NULL``.
* :return: nothing
*/
void
pkgconf_fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, bool escape, const pkgconf_fragment_render_ops_t *ops)
{
(void) escape;
ops = ops != NULL ? ops : &default_render_ops;
return ops->render_buf(list, buf, buflen, escape);
return ops->render_buf(list, buf, buflen, true);
}
/*
@ -549,7 +553,7 @@ pkgconf_fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen
* Allocate memory and render a `fragment list` into it.
*
* :param pkgconf_list_t* list: The `fragment list` being rendered.
* :param bool escape: Whether or not to escape special shell characters.
* :param bool escape: Whether or not to escape special shell characters (deprecated).
* :param pkgconf_fragment_render_ops_t* ops: An optional ops structure to use for custom renderers, else ``NULL``.
* :return: An allocated string containing the rendered `fragment list`.
* :rtype: char *
@ -557,10 +561,12 @@ pkgconf_fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen
char *
pkgconf_fragment_render(const pkgconf_list_t *list, bool escape, const pkgconf_fragment_render_ops_t *ops)
{
size_t buflen = pkgconf_fragment_render_len(list, escape, ops);
(void) escape;
size_t buflen = pkgconf_fragment_render_len(list, true, ops);
char *buf = calloc(1, buflen);
pkgconf_fragment_render_buf(list, buf, buflen, escape, ops);
pkgconf_fragment_render_buf(list, buf, buflen, true, ops);
return buf;
}