diff options
| author | Sadie Powell <sadie@witchery.services> | 2023-10-10 21:14:50 +0100 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2023-10-11 15:51:52 +0100 |
| commit | a3241065c55fd2a69e8793b89a5d0b1a957b3fd0 (patch) | |
| tree | 82f80ce2f3bbbdc1c1ef05fe611093cf0b34eab6 /include/modules/httpd.h | |
| parent | dc371aad6d059dbf7f30f6878c680532bedd4146 (diff) | |
Start migrating to range-based for loops.
Diffstat (limited to 'include/modules/httpd.h')
| -rw-r--r-- | include/modules/httpd.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/include/modules/httpd.h b/include/modules/httpd.h index 544ba5ccd..207499d3b 100644 --- a/include/modules/httpd.h +++ b/include/modules/httpd.h @@ -35,14 +35,14 @@ struct HTTPReply headers = other.headers; cookies = other.cookies; - for (unsigned i = 0; i < other.out.size(); ++i) - out.push_back(new Data(other.out[i]->buf, other.out[i]->len)); + for (const auto &datum : other.out) + out.push_back(new Data(datum->buf, datum->len)); } ~HTTPReply() { - for (unsigned i = 0; i < out.size(); ++i) - delete out[i]; + for (const auto *datum : out) + delete datum; out.clear(); } @@ -196,10 +196,8 @@ namespace HTTPUtils { Anope::string encoded; - for (unsigned i = 0; i < url.length(); ++i) + for (const auto c : url) { - const char& c = url[i]; - if (isalnum(c) || c == '.' || c == '-' || c == '*' || c == '_') encoded += c; else if (c == ' ') @@ -215,9 +213,9 @@ namespace HTTPUtils { Anope::string dst; - for (unsigned i = 0; i < src.length(); ++i) + for (const auto c : src) { - switch (src[i]) + switch (c) { case '<': dst += "<"; @@ -232,7 +230,7 @@ namespace HTTPUtils dst += "&"; break; default: - dst += src[i]; + dst += c; } } |
