Make use of the new rules to use `istnext()`. --- src/cache.c | 24 ++++++++++++------------ src/http_htx.c | 12 ++++-------- src/mqtt.c | 2 +- 3 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/src/cache.c b/src/cache.c index feab63f07..ba2b63c49 100644 --- a/src/cache.c +++ b/src/cache.c @@ -2180,49 +2180,49 @@ static int parse_encoding_value(struct ist encoding, unsigned int *encoding_valu switch (*encoding.ptr) { case 'a': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "aes128gcm", VARY_ENCODING_AES128GCM); break; case 'b': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "br", VARY_ENCODING_BR); break; case 'c': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "compress", VARY_ENCODING_COMPRESS); break; case 'd': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "deflate", VARY_ENCODING_DEFLATE); break; case 'e': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "exi", VARY_ENCODING_EXI); break; case 'g': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "gzip", VARY_ENCODING_GZIP); break; case 'i': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "identity", VARY_ENCODING_IDENTITY); break; case 'p': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "pack200-gzip", VARY_ENCODING_PACK200_GZIP); break; case 'x': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "x-gzip", VARY_ENCODING_GZIP); if (!*encoding_value) *encoding_value = CHECK_ENCODING(encoding, "x-compress", VARY_ENCODING_COMPRESS); break; case 'z': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = CHECK_ENCODING(encoding, "zstd", VARY_ENCODING_ZSTD); break; case '*': - encoding = istadv(encoding, 1); + encoding = istnext(encoding); *encoding_value = VARY_ENCODING_STAR; break; default: @@ -2238,7 +2238,7 @@ static int parse_encoding_value(struct ist encoding, unsigned int *encoding_valu return -1; if (has_null_weight) { - encoding = istadv(encoding, 1); + encoding = istnext(encoding); encoding = http_trim_leading_spht(encoding); diff --git a/src/http_htx.c b/src/http_htx.c index bfdcaef86..8028cfc99 100644 --- a/src/http_htx.c +++ b/src/http_htx.c @@ -146,8 +146,7 @@ static int __http_find_header(const struct htx *htx, const void *pattern, struct goto next_blk; /* Skip comma */ if (*(v.ptr) == ',') { - v.ptr++; - v.len--; + v = istnext(v); } goto return_hdr; @@ -216,8 +215,7 @@ static int __http_find_header(const struct htx *htx, const void *pattern, struct ctx->lws_before = 0; ctx->lws_after = 0; while (v.len && HTTP_IS_LWS(*v.ptr)) { - v.ptr++; - v.len--; + v = istnext(v); ctx->lws_before++; } if (!(flags & HTTP_FIND_FL_FULL)) @@ -457,16 +455,14 @@ int http_replace_req_query(struct htx *htx, const struct ist query) uri = htx_sl_req_uri(sl); q = uri; while (q.len > 0 && *(q.ptr) != '?') { - q.ptr++; - q.len--; + q = istnext(q); } /* skip the question mark or indicate that we must insert it * (but only if the format string is not empty then). */ if (q.len) { - q.ptr++; - q.len--; + q = istnext(q); } else if (query.len > 1) offset = 0; diff --git a/src/mqtt.c b/src/mqtt.c index 662420121..ebdb57d4e 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -183,7 +183,7 @@ static inline struct ist mqtt_read_1byte_int(struct ist parser, uint8_t *i) return IST_NULL; if (i) *i = (uint8_t)*istptr(parser); - parser = istadv(parser, 1); + parser = istnext(parser); return parser; } -- 2.33.1