diff --git a/perl/xs-src/pack.c b/perl/xs-src/pack.c
index fe646f1d..862808eb 100644
--- a/perl/xs-src/pack.c
+++ b/perl/xs-src/pack.c
@@ -47,8 +47,7 @@ STATIC_INLINE void need(enc_t* const enc, STRLEN const len);
 #define ERR_NESTING_EXCEEDED "perl structure exceeds maximum nesting level (max_depth set too low?)"
 
 
-STATIC_INLINE
-void need(enc_t* const enc, STRLEN const len)
+STATIC_INLINE void need(enc_t* const enc, STRLEN const len)
 {
     if (enc->cur + len >= enc->end) {
         dTHX;
@@ -62,8 +61,7 @@ void need(enc_t* const enc, STRLEN const len)
 
 static int s_pref_int = 0;
 
-STATIC_INLINE
-int pref_int_set(pTHX_ SV* sv, MAGIC* mg PERL_UNUSED_DECL) {
+STATIC_INLINE int pref_int_set(pTHX_ SV* sv, MAGIC* mg PERL_UNUSED_DECL) {
     if (SvTRUE(sv)) {
         s_pref_int = 1;
     } else {
@@ -92,8 +90,7 @@ void init_Data__MessagePack_pack(pTHX_ bool const cloning) {
 }
 
 
-STATIC_INLINE
-int try_int(enc_t* enc, const char *p, size_t len) {
+STATIC_INLINE int try_int(enc_t* enc, const char *p, size_t len) {
     int negative = 0;
     const char* pe = p + len;
     uint64_t num = 0;
@@ -147,11 +144,9 @@ int try_int(enc_t* enc, const char *p, size_t len) {
 }
 
 
-STATIC_INLINE
-void _msgpack_pack_rv(enc_t *enc, SV* sv, int depth);
+STATIC_INLINE void _msgpack_pack_rv(enc_t *enc, SV* sv, int depth);
 
-STATIC_INLINE
-void _msgpack_pack_sv(enc_t* const enc, SV* const sv, int const depth) {
+STATIC_INLINE void _msgpack_pack_sv(enc_t* const enc, SV* const sv, int const depth) {
     dTHX;
     assert(sv);
     if (UNLIKELY(depth <= 0)) Perl_croak(aTHX_ ERR_NESTING_EXCEEDED);
@@ -190,13 +185,12 @@ void _msgpack_pack_sv(enc_t* const enc, SV* const sv, int const depth) {
     }
 }
 
-STATIC_INLINE
-void _msgpack_pack_rv(enc_t *enc, SV* sv, int depth) {
+STATIC_INLINE void _msgpack_pack_rv(enc_t *enc, SV* sv, int depth) {
+    svtype svt;
     dTHX;
-
     assert(sv);
     SvGETMAGIC(sv);
-    svtype const svt = SvTYPE(sv);
+    svt = SvTYPE(sv);
 
     if (SvOBJECT (sv)) {
         HV *stash = gv_stashpv ("Data::MessagePack::Boolean", 1); // TODO: cache?
@@ -207,8 +201,8 @@ void _msgpack_pack_rv(enc_t *enc, SV* sv, int depth) {
                 msgpack_pack_false(enc);
             }
         } else {
-            croak ("encountered object '%"SVf"', Data::MessagePack doesn't allow the object",
-                           sv_2mortal(newRV_inc(sv)));
+            croak ("encountered object '%s', Data::MessagePack doesn't allow the object",
+                           SvPV_nolen(sv_2mortal(newRV_inc(sv))));
         }
     } else if (svt == SVt_PVHV) {
         HV* hval = (HV*)sv;
@@ -244,12 +238,12 @@ void _msgpack_pack_rv(enc_t *enc, SV* sv, int depth) {
             msgpack_pack_false(enc); 
         else {
             //sv_dump(sv);
-            croak("cannot encode reference to scalar '%"SVf"' unless the scalar is 0 or 1",
-                    sv_2mortal(newRV_inc(sv)));
+            croak("cannot encode reference to scalar '%s' unless the scalar is 0 or 1",
+                    SvPV_nolen (sv_2mortal (newRV_inc (sv))));
         }
     } else {
-        croak ("encountered %"SVf", but msgpack can only represent references to arrays or hashes",
-                   sv_2mortal(newRV_inc(sv)));
+        croak ("encountered %s, but msgpack can only represent references to arrays or hashes",
+                   SvPV_nolen (sv_2mortal (newRV_inc (sv))));
     }
 }
 
@@ -272,10 +266,8 @@ XS(xs_pack) {
     _msgpack_pack_sv(&enc, val, depth);
 
     SvCUR_set(enc.sv, enc.cur - SvPVX (enc.sv));
-    /* many C functions expect a trailing NUL for strings */
-    *SvEND(enc.sv) = '\0';
+    *SvEND (enc.sv) = 0; /* many xs functions expect a trailing 0 for text strings */
 
     ST(0) = enc.sv;
     XSRETURN(1);
 }
-
diff --git a/perl/xs-src/unpack.c b/perl/xs-src/unpack.c
index 2294446e..e3f62c63 100644
--- a/perl/xs-src/unpack.c
+++ b/perl/xs-src/unpack.c
@@ -101,24 +101,21 @@ static SV* template_data(msgpack_unpack_t* u);
 static int template_execute(msgpack_unpack_t* u PERL_UNUSED_DECL,
     const char* data, size_t len, size_t* off);
 
-STATIC_INLINE
-SV* template_callback_root(unpack_user* u PERL_UNUSED_DECL)
+STATIC_INLINE SV* template_callback_root(unpack_user* u PERL_UNUSED_DECL)
 {
     return NULL;
 }
 
 #if IVSIZE == 4
 
-STATIC_INLINE
-int template_callback_UV(unpack_user* u PERL_UNUSED_DECL, UV const d, SV** o)
+STATIC_INLINE int template_callback_UV(unpack_user* u PERL_UNUSED_DECL, UV const d, SV** o)
 {
     dTHX;
     *o = newSVuv(d);
     return 0;
 }
 
-STATIC_INLINE
-int template_callback_IV(unpack_user* u PERL_UNUSED_DECL, IV const d, SV** o)
+STATIC_INLINE int template_callback_IV(unpack_user* u PERL_UNUSED_DECL, IV const d, SV** o)
 {
     dTHX;
     *o = newSViv(d);
@@ -126,8 +123,7 @@ int template_callback_IV(unpack_user* u PERL_UNUSED_DECL, IV const d, SV** o)
 }
 
 /* workaround win32 problems (my_snprintf(%llu) returns incorrect values ) */
-static
-char* str_from_uint64(char* buf_end, uint64_t v)
+static char* str_from_uint64(char* buf_end, uint64_t v)
 {
   char *p = buf_end;
   *--p = '\0';
@@ -137,8 +133,7 @@ char* str_from_uint64(char* buf_end, uint64_t v)
   return p;
 }
 
-static
-const char* str_from_int64(char* buf_end, int64_t const v) {
+static const char* str_from_int64(char* buf_end, int64_t const v) {
   bool const minus = v < 0;
   char* p = str_from_uint64(buf_end, minus ? -v : v);
   if (minus)
@@ -146,8 +141,7 @@ const char* str_from_int64(char* buf_end, int64_t const v) {
   return p;
 }
 
-static
-int template_callback_uint64(unpack_user* u PERL_UNUSED_DECL, uint64_t const d, SV** o)
+static int template_callback_uint64(unpack_user* u PERL_UNUSED_DECL, uint64_t const d, SV** o)
 {
     dTHX;
     char tbuf[64];
@@ -156,8 +150,7 @@ int template_callback_uint64(unpack_user* u PERL_UNUSED_DECL, uint64_t const d,
     return 0;
 }
 
-static
-int template_callback_int64(unpack_user* u PERL_UNUSED_DECL, int64_t const d, SV** o)
+static int template_callback_int64(unpack_user* u PERL_UNUSED_DECL, int64_t const d, SV** o)
 {
     dTHX;
     char tbuf[64];
@@ -169,8 +162,7 @@ int template_callback_int64(unpack_user* u PERL_UNUSED_DECL, int64_t const d, SV
 #else /* IVSIZE == 8 */
 
 
-STATIC_INLINE
-int template_callback_UV(unpack_user* u PERL_UNUSED_DECL, UV const d, SV** o)
+STATIC_INLINE int template_callback_UV(unpack_user* u PERL_UNUSED_DECL, UV const d, SV** o)
 {
     dTHX;
     *o = newSVuv(d);
@@ -200,8 +192,7 @@ STATIC_INLINE int template_callback_IV(unpack_user* u PERL_UNUSED_DECL, IV const
 
 #define template_callback_float template_callback_double
 
-STATIC_INLINE
-int template_callback_double(unpack_user* u PERL_UNUSED_DECL, double d, SV** o)
+STATIC_INLINE int template_callback_double(unpack_user* u PERL_UNUSED_DECL, double d, SV** o)
 {
     dTHX;
     *o = newSVnv(d);
@@ -209,30 +200,26 @@ int template_callback_double(unpack_user* u PERL_UNUSED_DECL, double d, SV** o)
 }
 
 /* &PL_sv_undef is not so good. see http://gist.github.com/387743 */
-STATIC_INLINE
-int template_callback_nil(unpack_user* u PERL_UNUSED_DECL, SV** o)
+STATIC_INLINE int template_callback_nil(unpack_user* u PERL_UNUSED_DECL, SV** o)
 {
     dTHX;
     *o = newSV(0);
     return 0;
 }
 
-STATIC_INLINE
-int template_callback_true(unpack_user* u PERL_UNUSED_DECL, SV** o)
+STATIC_INLINE int template_callback_true(unpack_user* u PERL_UNUSED_DECL, SV** o)
 {
     *o = get_bool(true);
     return 0;
 }
 
-STATIC_INLINE
-int template_callback_false(unpack_user* u PERL_UNUSED_DECL, SV** o)
+STATIC_INLINE int template_callback_false(unpack_user* u PERL_UNUSED_DECL, SV** o)
 {
     *o = get_bool(false);
     return 0;
 }
 
-STATIC_INLINE
-int template_callback_array(unpack_user* u PERL_UNUSED_DECL, unsigned int n, SV** o)
+STATIC_INLINE int template_callback_array(unpack_user* u PERL_UNUSED_DECL, unsigned int n, SV** o)
 {
     dTHX;
     AV* const a = newAV();
@@ -241,8 +228,7 @@ int template_callback_array(unpack_user* u PERL_UNUSED_DECL, unsigned int n, SV*
     return 0;
 }
 
-STATIC_INLINE
-int template_callback_array_item(unpack_user* u PERL_UNUSED_DECL, SV** c, SV* o)
+STATIC_INLINE int template_callback_array_item(unpack_user* u PERL_UNUSED_DECL, SV** c, SV* o)
 {
     dTHX;
     AV* const a = (AV*)SvRV(*c);
@@ -251,8 +237,7 @@ int template_callback_array_item(unpack_user* u PERL_UNUSED_DECL, SV** c, SV* o)
     return 0;
 }
 
-STATIC_INLINE
-int template_callback_map(unpack_user* u PERL_UNUSED_DECL, unsigned int n, SV** o)
+STATIC_INLINE int template_callback_map(unpack_user* u PERL_UNUSED_DECL, unsigned int n, SV** o)
 {
     dTHX;
     HV* const h = newHV();
@@ -261,8 +246,7 @@ int template_callback_map(unpack_user* u PERL_UNUSED_DECL, unsigned int n, SV**
     return 0;
 }
 
-STATIC_INLINE
-int template_callback_map_item(unpack_user* u PERL_UNUSED_DECL, SV** c, SV* k, SV* v)
+STATIC_INLINE int template_callback_map_item(unpack_user* u PERL_UNUSED_DECL, SV** c, SV* k, SV* v)
 {
     dTHX;
     HV* const h = (HV*)SvRV(*c);
@@ -272,8 +256,7 @@ int template_callback_map_item(unpack_user* u PERL_UNUSED_DECL, SV** c, SV* k, S
     return 0;
 }
 
-STATIC_INLINE int
-template_callback_raw(unpack_user* u PERL_UNUSED_DECL, const char* b PERL_UNUSED_DECL, const char* p, unsigned int l, SV** o)
+STATIC_INLINE int template_callback_raw(unpack_user* u PERL_UNUSED_DECL, const char* b PERL_UNUSED_DECL, const char* p, unsigned int l, SV** o)
 {
     dTHX;
     /*  newSVpvn(p, l) returns an undef if p == NULL */