Skip to content

Commit 8fd4667

Browse files
committed
util/uri: Remove the uri_string_escape() function
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>
1 parent fdd16f1 commit 8fd4667

File tree

2 files changed

+0
-71
lines changed

2 files changed

+0
-71
lines changed

include/qemu/uri.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ URI *uri_parse(const char *str);
7676
URI *uri_parse_raw(const char *str, int raw);
7777
int uri_parse_into(URI *uri, const char *str);
7878
char *uri_to_string(URI *uri);
79-
char *uri_string_escape(const char *str, const char *list);
8079
void uri_free(URI *uri);
8180

8281
/* Single web service query parameter 'name=value'. */

util/uri.c

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,76 +1349,6 @@ void uri_free(URI *uri)
13491349
g_free(uri);
13501350
}
13511351

1352-
/************************************************************************
1353-
* *
1354-
* Helper functions *
1355-
* *
1356-
************************************************************************/
1357-
1358-
/**
1359-
* uri_string_escape:
1360-
* @str: string to escape
1361-
* @list: exception list string of chars not to escape
1362-
*
1363-
* This routine escapes a string to hex, ignoring reserved characters (a-z)
1364-
* and the characters in the exception list.
1365-
*
1366-
* Returns a new escaped string or NULL in case of error.
1367-
*/
1368-
char *uri_string_escape(const char *str, const char *list)
1369-
{
1370-
char *ret, ch;
1371-
char *temp;
1372-
const char *in;
1373-
int len, out;
1374-
1375-
if (str == NULL) {
1376-
return NULL;
1377-
}
1378-
if (str[0] == 0) {
1379-
return g_strdup(str);
1380-
}
1381-
len = strlen(str);
1382-
if (!(len > 0)) {
1383-
return NULL;
1384-
}
1385-
1386-
len += 20;
1387-
ret = g_malloc(len);
1388-
in = str;
1389-
out = 0;
1390-
while (*in != 0) {
1391-
if (len - out <= 3) {
1392-
temp = realloc2n(ret, &len);
1393-
ret = temp;
1394-
}
1395-
1396-
ch = *in;
1397-
1398-
if ((ch != '@') && (!IS_UNRESERVED(ch)) && (!strchr(list, ch))) {
1399-
unsigned char val;
1400-
ret[out++] = '%';
1401-
val = ch >> 4;
1402-
if (val <= 9) {
1403-
ret[out++] = '0' + val;
1404-
} else {
1405-
ret[out++] = 'A' + val - 0xA;
1406-
}
1407-
val = ch & 0xF;
1408-
if (val <= 9) {
1409-
ret[out++] = '0' + val;
1410-
} else {
1411-
ret[out++] = 'A' + val - 0xA;
1412-
}
1413-
in++;
1414-
} else {
1415-
ret[out++] = *in++;
1416-
}
1417-
}
1418-
ret[out] = 0;
1419-
return ret;
1420-
}
1421-
14221352
/************************************************************************
14231353
* *
14241354
* Public functions *

0 commit comments

Comments
 (0)