Re: [PATCH 3/5] util/uri: Remove the uri_string_escape() function

2024-01-22 Thread Thomas Huth

On 22/01/2024 21.59, Stefan Weil wrote:

Am 22.01.24 um 20:17 schrieb Thomas Huth:


It is not used in QEMU - and if somebody needs this functionality,
they can simply use g_uri_escape_string() from the glib instead.

Signed-off-by: Thomas Huth 
---
  include/qemu/uri.h |  1 -
  util/uri.c | 64 --
  2 files changed, 65 deletions(-)



The removed function is used in util/uri.c, so this patch breaks the 
compilation.


That can be fixed by applying patch 4 before this one.

With that re-ordering you may add my signature:

Reviewed-by: Stefan Weil 


D'oh, I originally developed the patches the other way round indeed, but 
then thought it would be nicer for review this way and swapped the order 
without checking :-( ... I'll swap it back again.


Thanks!

 Thomas




Re: [PATCH 3/5] util/uri: Remove the uri_string_escape() function

2024-01-22 Thread Stefan Weil via

Am 22.01.24 um 20:17 schrieb Thomas Huth:


It is not used in QEMU - and if somebody needs this functionality,
they can simply use g_uri_escape_string() from the glib instead.

Signed-off-by: Thomas Huth 
---
  include/qemu/uri.h |  1 -
  util/uri.c | 64 --
  2 files changed, 65 deletions(-)



The removed function is used in util/uri.c, so this patch breaks the 
compilation.


That can be fixed by applying patch 4 before this one.

With that re-ordering you may add my signature:

Reviewed-by: Stefan Weil 




[PATCH 3/5] util/uri: Remove the uri_string_escape() function

2024-01-22 Thread Thomas Huth
It is not used in QEMU - and if somebody needs this functionality,
they can simply use g_uri_escape_string() from the glib instead.

Signed-off-by: Thomas Huth 
---
 include/qemu/uri.h |  1 -
 util/uri.c | 64 --
 2 files changed, 65 deletions(-)

diff --git a/include/qemu/uri.h b/include/qemu/uri.h
index aa54b6f251..c1734d28c3 100644
--- a/include/qemu/uri.h
+++ b/include/qemu/uri.h
@@ -78,7 +78,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);
 char *uri_string_unescape(const char *str, int len);
 void uri_free(URI *uri);
 
diff --git a/util/uri.c b/util/uri.c
index 2a75f535ba..912e406523 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1589,70 +1589,6 @@ char *uri_string_unescape(const char *str, int len)
 return g_uri_unescape_string(lstr, NULL);
 }
 
-/**
- * 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, );
-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