From 0fa5220d8d7cddbb668d02045ebd36709ba0bc6f Mon Sep 17 00:00:00 2001 From: tylo Date: Wed, 6 Oct 2021 09:47:51 +0200 Subject: More removal of parameter side-effects when invoking i_valfrom() i_valto() in cvec, cdeq. --- include/stc/cdeq.h | 8 ++++---- include/stc/cvec.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h index 7a5ae690..f31000db 100644 --- a/include/stc/cdeq.h +++ b/include/stc/cdeq.h @@ -315,11 +315,11 @@ cx_memb(_push_front)(Self* self, i_val value) { } STC_DEF cx_iter_t -cx_memb(_insert_range_p)(Self* self, cx_value_t* pos, const cx_value_t* p1, - const cx_value_t* p2, bool clone) { +cx_memb(_insert_range_p)(Self* self, cx_value_t* pos, + const cx_value_t* p1, const cx_value_t* p2, bool clone) { pos = cx_memb(_insert_space_)(self, pos, p2 - p1); cx_iter_t it = {pos}; - if (clone) while (p1 != p2) *pos++ = i_valfrom(i_valto(p1++)); + if (clone) while (p1 != p2) { *pos++ = i_valfrom(i_valto(p1)); ++p1; } else memcpy(pos, p1, (p2 - p1)*sizeof *p1); return it; } @@ -328,7 +328,7 @@ STC_DEF cx_iter_t cx_memb(_emplace_range_p)(Self* self, cx_value_t* pos, const cx_rawvalue_t* p1, const cx_rawvalue_t* p2) { pos = cx_memb(_insert_space_)(self, pos, p2 - p1); cx_iter_t it = {pos}; - while (p1 != p2) *pos++ = i_valfrom(*p1++); + while (p1 != p2) { *pos++ = i_valfrom(*p1); ++p1; } return it; } diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 283e769d..745411fc 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -305,11 +305,11 @@ cx_memb(_insert_space_)(Self* self, cx_value_t* pos, size_t len) { } STC_DEF cx_iter_t -cx_memb(_insert_range_p)(Self* self, cx_value_t* pos, const cx_value_t* p1, - const cx_value_t* p2, bool clone) { +cx_memb(_insert_range_p)(Self* self, cx_value_t* pos, + const cx_value_t* p1, const cx_value_t* p2, bool clone) { pos = cx_memb(_insert_space_)(self, pos, p2 - p1); cx_iter_t it = {pos}; - if (clone) while (p1 != p2) *pos++ = i_valfrom(i_valto(p1++)); + if (clone) while (p1 != p2) { *pos++ = i_valfrom(i_valto(p1)); ++p1; } else memcpy(pos, p1, (p2 - p1)*sizeof *p1); return it; } @@ -319,7 +319,7 @@ cx_memb(_emplace_range_p)(Self* self, cx_value_t* pos, const cx_rawvalue_t* p1, const cx_rawvalue_t* p2) { pos = cx_memb(_insert_space_)(self, pos, p2 - p1); cx_iter_t it = {pos}; - while (p1 != p2) *pos++ = i_valfrom(*p1++); + while (p1 != p2) { *pos++ = i_valfrom(*p1); ++p1; } return it; } -- cgit v1.2.3