This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re-implement SHIFT16 and SHIFT32 as wrappers to SHIFT_BYTES.
authorNicholas Clark <nick@ccl4.org>
Tue, 7 May 2013 09:53:17 +0000 (11:53 +0200)
committerNicholas Clark <nick@ccl4.org>
Mon, 20 May 2013 19:19:43 +0000 (21:19 +0200)
pp_pack.c

index 4062832..98481f6 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -129,26 +129,6 @@ typedef union {
 #  define OFF32(p)     ((char *) (p))
 #endif
 
-/* Only to be used inside a loop (see the break) */
-#define SHIFT16(utf8, s, strend, p, datumtype) STMT_START {            \
-    if (utf8) {                                                                \
-       if (!uni_to_bytes(aTHX_ &(s), strend, OFF16(p), SIZE16, datumtype)) break;      \
-    } else {                                                           \
-       Copy(s, OFF16(p), SIZE16, char);                                \
-       (s) += SIZE16;                                                  \
-    }                                                                  \
-} STMT_END
-
-/* Only to be used inside a loop (see the break) */
-#define SHIFT32(utf8, s, strend, p, datumtype) STMT_START {            \
-    if (utf8) {                                                                \
-       if (!uni_to_bytes(aTHX_ &(s), strend, OFF32(p), SIZE32, datumtype)) break;      \
-    } else {                                                           \
-       Copy(s, OFF32(p), SIZE32, char);                                \
-       (s) += SIZE32;                                                  \
-    }                                                                  \
-} STMT_END
-
 #define PUSH16(utf8, cur, p) PUSH_BYTES(utf8, cur, OFF16(p), SIZE16)
 #define PUSH32(utf8, cur, p) PUSH_BYTES(utf8, cur, OFF32(p), SIZE32)
 
@@ -173,6 +153,12 @@ STMT_START {                                               \
     }                                                  \
 } STMT_END
 
+#define SHIFT16(utf8, s, strend, p, datumtype)                          \
+       SHIFT_BYTES(utf8, s, strend, OFF16(p), SIZE16, datumtype)
+
+#define SHIFT32(utf8, s, strend, p, datumtype)                          \
+       SHIFT_BYTES(utf8, s, strend, OFF32(p), SIZE32, datumtype)
+
 #define SHIFT_VAR(utf8, s, strend, var, datumtype)     \
        SHIFT_BYTES(utf8, s, strend, &(var), sizeof(var), datumtype)