From cad2515be5513904aeb5e2a98d69e66ec4317bb8 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 10 Dec 2017 00:36:20 -0600 Subject: [PATCH] libpkgconf: fragment: there are no consumers of non-escaped rendered fragment lists, so deprecate the option --- libpkgconf/fragment.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/libpkgconf/fragment.c b/libpkgconf/fragment.c index a65cde4..ef749fc 100644 --- a/libpkgconf/fragment.c +++ b/libpkgconf/fragment.c @@ -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; }