CLEANUP: Apply ist.cocci
Make use of the new rules to use `istend()`.
diff --git a/src/htx.c b/src/htx.c
index 8c6e368..940989c 100644
--- a/src/htx.c
+++ b/src/htx.c
@@ -601,11 +601,13 @@
if (delta <= 0) {
/* compression: copy new data first then move the end */
memcpy(old.ptr, new.ptr, new.len);
- memmove(old.ptr + new.len, old.ptr + old.len, (v.ptr + v.len) - (old.ptr + old.len));
+ memmove(old.ptr + new.len, istend(old),
+ istend(v) - istend(old));
}
else {
/* expansion: move the end first then copy new data */
- memmove(old.ptr + new.len, old.ptr + old.len, (v.ptr + v.len) - (old.ptr + old.len));
+ memmove(old.ptr + new.len, istend(old),
+ istend(v) - istend(old));
memcpy(old.ptr, new.ptr, new.len);
}
@@ -629,7 +631,7 @@
ptr += new.len;
/* Copy value after old part, if any */
- memcpy(ptr, old.ptr + old.len, (v.ptr + v.len) - (old.ptr + old.len));
+ memcpy(ptr, istend(old), istend(v) - istend(old));
/* set the new block size and update HTX message */
htx_set_blk_value_len(blk, v.len + delta);
@@ -654,7 +656,8 @@
/* move the end first and copy new data
*/
- memmove(old.ptr + offset + new.len, old.ptr + offset + old.len, (v.ptr + v.len) - (old.ptr + old.len));
+ memmove(old.ptr + offset + new.len, old.ptr + offset + old.len,
+ istend(v) - istend(old));
memcpy(old.ptr + offset, new.ptr, new.len);
}
return blk;