dovecot-2.2: lib: uri_parser_init() wasn't using pool parameter ...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Oct 13 17:43:28 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/b0545670fd99
changeset: 19299:b0545670fd99
user: Timo Sirainen <tss at iki.fi>
date: Tue Oct 13 20:41:36 2015 +0300
description:
lib: uri_parser_init() wasn't using pool parameter for anything.
Now everything is allocated from it instead of from data stack.
diffstat:
src/lib/uri-util.c | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diffs (135 lines):
diff -r 6bb60a869c71 -r b0545670fd99 src/lib/uri-util.c
--- a/src/lib/uri-util.c Tue Oct 13 20:40:38 2015 +0300
+++ b/src/lib/uri-util.c Tue Oct 13 20:41:36 2015 +0300
@@ -103,7 +103,7 @@
}
if ((value = _decode_hex_digit(**p)) < 0) {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Expecting hex digit after '%%', but found '%c'", **p);
return -1;
}
@@ -112,7 +112,7 @@
*p += 1;
if ((value = _decode_hex_digit(**p)) < 0) {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Expecting hex digit after '%%%c', but found '%c'", *((*p)-1), **p);
return -1;
}
@@ -207,7 +207,7 @@
}
if (decoded_r != NULL)
- *decoded_r = t_strdup(str_c(decoded));
+ *decoded_r = p_strdup(parser->pool, str_c(decoded));
return TRUE;
}
@@ -252,6 +252,8 @@
return 0;
parser->cur = (const unsigned char *)p;
+ if (!parser->pool->datastack_pool)
+ *scheme_r = p_strdup(parser->pool, *scheme_r);
return 1;
}
@@ -400,12 +402,12 @@
return -1;
}
if (*address == 'v') {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Future IP host address '%s' not supported", address);
return -1;
}
if ((ret = inet_pton(AF_INET6, address, &ip6)) <= 0) {
- parser->error = t_strdup_printf(
+ parser->error = p_strdup_printf(parser->pool,
"Invalid IPv6 host address '%s'", address);
return -1;
}
@@ -439,7 +441,7 @@
return -1;
if (auth != NULL) {
- auth->host_literal = t_strdup(str_c(literal));
+ auth->host_literal = p_strdup(parser->pool, str_c(literal));
auth->host_ip.family = AF_INET6;
auth->host_ip.u.ip6 = ip6;
auth->have_host_ip = TRUE;
@@ -458,7 +460,7 @@
preserve = parser->cur;
if ((ret = uri_parse_ipv4address(parser, literal, &ip4)) > 0) {
if (auth != NULL) {
- auth->host_literal = t_strdup(str_c(literal));
+ auth->host_literal = p_strdup(parser->pool, str_c(literal));
auth->host_ip.family = AF_INET;
auth->host_ip.u.ip4 = ip4;
auth->have_host_ip = TRUE;
@@ -472,7 +474,7 @@
if (uri_parse_reg_name(parser, literal) < 0)
return -1;
if (auth != NULL) {
- auth->host_literal = t_strdup(str_c(literal));
+ auth->host_literal = p_strdup(parser->pool, str_c(literal));
auth->have_host_ip = FALSE;
}
return 0;
@@ -535,7 +537,7 @@
/* Extract userinfo */
if (p < parser->end && *p == '@') {
if (auth != NULL)
- auth->enc_userinfo = t_strdup_until(parser->cur, p);
+ auth->enc_userinfo = p_strdup_until(parser->pool, parser->cur, p);
parser->cur = p+1;
}
@@ -605,7 +607,7 @@
return 0;
if (segment_r != NULL)
- *segment_r = t_strdup_until(parser->cur, p);
+ *segment_r = p_strdup_until(parser->pool, parser->cur, p);
parser->cur = p;
return 1;
}
@@ -622,7 +624,7 @@
count = 0;
if (path_r != NULL)
- t_array_init(&segments, 16);
+ p_array_init(&segments, parser->pool, 16);
else
memset(&segments, 0, sizeof(segments));
@@ -740,7 +742,7 @@
}
if (query_r != NULL)
- *query_r = t_strdup_until(parser->cur+1, p);
+ *query_r = p_strdup_until(parser->pool, parser->cur+1, p);
parser->cur = p;
return 1;
}
@@ -777,7 +779,7 @@
}
if (fragment_r != NULL)
- *fragment_r = t_strdup_until(parser->cur+1, p);
+ *fragment_r = p_strdup_until(parser->pool, parser->cur+1, p);
parser->cur = p;
return 1;
}
@@ -794,7 +796,7 @@
string_t *uri_parser_get_tmpbuf(struct uri_parser *parser, size_t size)
{
if (parser->tmpbuf == NULL)
- parser->tmpbuf = t_str_new(size);
+ parser->tmpbuf = str_new(parser->pool, size);
else
str_truncate(parser->tmpbuf, 0);
return parser->tmpbuf;
More information about the dovecot-cvs
mailing list