Skip to content

Commit 816209d

Browse files
committed
reformat MoveD/CopyD/ZeroD over multiple lines
It is a bit hard to tell (and even harder to change) what exactly these macros are doing if everything is crammed into one line.
1 parent 9562cef commit 816209d

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

handy.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,9 +2855,26 @@ enum mem_log_type {
28552855
#define Zero(d,n,t) ((void)ZeroD(d, n, t))
28562856

28572857
/* Like above, but returns a pointer to 'd' */
2858-
#define MoveD(s,d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), perl_assert_ptr(s), memmove((char*)(d),(const char*)(s), (n) * sizeof(t)))
2859-
#define CopyD(s,d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), perl_assert_ptr(s), memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
2860-
#define ZeroD(d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), memzero((char*)(d), (n) * sizeof(t)))
2858+
#define MoveD(s,d,n,t) \
2859+
( \
2860+
MEM_WRAP_CHECK_(n,t) \
2861+
perl_assert_ptr(d), \
2862+
perl_assert_ptr(s), \
2863+
memmove((char*)(d),(const char*)(s), (n) * sizeof(t)) \
2864+
)
2865+
#define CopyD(s,d,n,t) \
2866+
( \
2867+
MEM_WRAP_CHECK_(n,t) \
2868+
perl_assert_ptr(d), \
2869+
perl_assert_ptr(s), \
2870+
memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)) \
2871+
)
2872+
#define ZeroD(d,n,t) \
2873+
( \
2874+
MEM_WRAP_CHECK_(n,t) \
2875+
perl_assert_ptr(d), \
2876+
memzero((char*)(d), (n) * sizeof(t)) \
2877+
)
28612878

28622879
#define NewCopy(s,d,n,t) STMT_START { \
28632880
Newx(d,n,t); \

0 commit comments

Comments
 (0)