Skip to content

Commit 9562cef

Browse files
committed
remove duplicated code in Move/Copy/Zero
These macros are identical to the ...D forms except for their return type, which is void. So just define Move/Copy/Zero in terms of MoveD/CopyD/ZeroD.
1 parent c27ae6c commit 9562cef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

handy.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,9 +2850,9 @@ enum mem_log_type {
28502850
#define perl_assert_ptr(p) assert( ((void*)(p)) != 0 )
28512851

28522852

2853-
#define Move(s,d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), perl_assert_ptr(s), (void)memmove((char*)(d),(const char*)(s), (n) * sizeof(t)))
2854-
#define Copy(s,d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), perl_assert_ptr(s), (void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
2855-
#define Zero(d,n,t) (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), (void)memzero((char*)(d), (n) * sizeof(t)))
2853+
#define Move(s,d,n,t) ((void)MoveD(s, d, n, t))
2854+
#define Copy(s,d,n,t) ((void)CopyD(s, d, n, t))
2855+
#define Zero(d,n,t) ((void)ZeroD(d, n, t))
28562856

28572857
/* Like above, but returns a pointer to 'd' */
28582858
#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)))

0 commit comments

Comments
 (0)