All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [PULL 6/7] util/uri: Remove the uri_string_escape() function
Date: Wed, 24 Jan 2024 11:42:30 +0100	[thread overview]
Message-ID: <20240124104231.603418-7-thuth@redhat.com> (raw)
In-Reply-To: <20240124104231.603418-1-thuth@redhat.com>

Now that uri_resolve_relative() has been removed, this function is not
used in QEMU anymore - and if somebody needs this functionality, they
can simply use g_uri_escape_string() from the glib instead.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: "Daniel P. Berrangé" <berrange@redhat.com>
Message-ID: <20240123182247.432642-4-thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/qemu/uri.h |  1 -
 util/uri.c         | 70 ----------------------------------------------
 2 files changed, 71 deletions(-)

diff --git a/include/qemu/uri.h b/include/qemu/uri.h
index 899ce852f5..255e61f452 100644
--- a/include/qemu/uri.h
+++ b/include/qemu/uri.h
@@ -76,7 +76,6 @@ URI *uri_parse(const char *str);
 URI *uri_parse_raw(const char *str, int raw);
 int uri_parse_into(URI *uri, const char *str);
 char *uri_to_string(URI *uri);
-char *uri_string_escape(const char *str, const char *list);
 void uri_free(URI *uri);
 
 /* Single web service query parameter 'name=value'. */
diff --git a/util/uri.c b/util/uri.c
index 1891ca6fb3..350835b03f 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1349,76 +1349,6 @@ void uri_free(URI *uri)
     g_free(uri);
 }
 
-/************************************************************************
- *                                                                      *
- *                           Helper functions                           *
- *                                                                      *
- ************************************************************************/
-
-/**
- * uri_string_escape:
- * @str:  string to escape
- * @list: exception list string of chars not to escape
- *
- * This routine escapes a string to hex, ignoring reserved characters (a-z)
- * and the characters in the exception list.
- *
- * Returns a new escaped string or NULL in case of error.
- */
-char *uri_string_escape(const char *str, const char *list)
-{
-    char *ret, ch;
-    char *temp;
-    const char *in;
-    int len, out;
-
-    if (str == NULL) {
-        return NULL;
-    }
-    if (str[0] == 0) {
-        return g_strdup(str);
-    }
-    len = strlen(str);
-    if (!(len > 0)) {
-        return NULL;
-    }
-
-    len += 20;
-    ret = g_malloc(len);
-    in = str;
-    out = 0;
-    while (*in != 0) {
-        if (len - out <= 3) {
-            temp = realloc2n(ret, &len);
-            ret = temp;
-        }
-
-        ch = *in;
-
-        if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!strchr(list, ch))) {
-            unsigned char val;
-            ret[out++] = '%';
-            val = ch >> 4;
-            if (val <= 9) {
-                ret[out++] = '0' + val;
-            } else {
-                ret[out++] = 'A' + val - 0xA;
-            }
-            val = ch & 0xF;
-            if (val <= 9) {
-                ret[out++] = '0' + val;
-            } else {
-                ret[out++] = 'A' + val - 0xA;
-            }
-            in++;
-        } else {
-            ret[out++] = *in++;
-        }
-    }
-    ret[out] = 0;
-    return ret;
-}
-
 /************************************************************************
  *                                                                      *
  *                           Public functions                           *
-- 
2.43.0



  parent reply	other threads:[~2024-01-24 10:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 10:42 [PULL 0/7] Test timeout fixes and URI code clean up Thomas Huth
2024-01-24 10:42 ` [PULL 1/7] tests/qtest: Bump timeout of the boot-serial-test to 360 seconds Thomas Huth
2024-01-24 10:42 ` [PULL 2/7] tests/unit/test-iov: Fix timeout problem on NetBSD and OpenBSD Thomas Huth
2024-01-24 10:42 ` [PULL 3/7] tests/qtest: Bump timeouts of boot_sector_test()-based tests to 610 seconds Thomas Huth
2024-01-24 10:42 ` [PULL 4/7] util/uri: Remove uri_string_unescape() Thomas Huth
2024-01-24 10:42 ` [PULL 5/7] util/uri: Remove unused functions uri_resolve() and uri_resolve_relative() Thomas Huth
2024-01-24 10:42 ` Thomas Huth [this message]
2024-01-24 10:42 ` [PULL 7/7] util/uri: Remove unused macros ISA_RESERVED() and ISA_GEN_DELIM() Thomas Huth
2024-01-25 15:11 ` [PULL 0/7] Test timeout fixes and URI code clean up Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240124104231.603418-7-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.