From 11ca072fe823919abf4c5f5c8f26771cdcd705e2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 9 Sep 2014 20:00:54 +0000
Subject: haiku patch


diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c
index 570f476..114fa09 100644
--- a/gettext-runtime/intl/loadmsgcat.c
+++ b/gettext-runtime/intl/loadmsgcat.c
@@ -785,7 +785,6 @@ internal_function
 _nl_load_domain (struct loaded_l10nfile *domain_file,
 		 struct binding *domainbinding)
 {
-  __libc_lock_define_initialized_recursive (static, lock);
   int fd = -1;
   size_t size;
 #ifdef _LIBC
@@ -799,6 +798,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
   int revision;
   const char *nullentry;
   size_t nullentrylen;
+  __libc_lock_define_initialized_recursive (static, lock);
 
   __libc_lock_lock_recursive (lock);
   if (domain_file->decided != 0)
diff --git a/gettext-tools/src/x-lua.c b/gettext-tools/src/x-lua.c
index 9fcc20d..b0720d4 100644
--- a/gettext-tools/src/x-lua.c
+++ b/gettext-tools/src/x-lua.c
@@ -281,9 +281,9 @@ phase2_getc ()
 
           if (c == '[')
             {
-              c = phase1_getc ();
 
               int esigns = 0;
+              c = phase1_getc ();
               while (c == '=')
                 {
                   esigns++;
@@ -703,11 +703,11 @@ phase3_get (token_ty *tp)
             }
           break;
 
-        case '[':
+        case '[': {
+          int esigns = 0;
           c = phase1_getc ();
 
           /* Count the number of equal signs.  */
-          int esigns = 0;
           while (c == '=')
             {
               esigns++;
@@ -739,10 +739,10 @@ phase3_get (token_ty *tp)
 
               if (c == ']')
                 {
+                  int esigns2 = 0;
                   c = phase1_getc ();
 
                   /* Count the number of equal signs.  */
-                  int esigns2 = 0;
                   while (c == '=')
                     {
                       esigns2++;
@@ -792,7 +792,7 @@ phase3_get (token_ty *tp)
                 }
             }
           break;
-
+        }
         case ']':
           tp->type = token_type_rbracket;
           return;
-- 
1.8.3.4


From 9f8db4ffc826eb8cf08acc743ca279ddc11cb454 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Thu, 16 Oct 2014 08:51:57 +0200
Subject: Fix C99ism in tests.


diff --git a/gettext-tools/gnulib-tests/test-quotearg-simple.c b/gettext-tools/gnulib-tests/test-quotearg-simple.c
index 08aadc1..4657fbf 100644
--- a/gettext-tools/gnulib-tests/test-quotearg-simple.c
+++ b/gettext-tools/gnulib-tests/test-quotearg-simple.c
@@ -309,14 +309,16 @@ main (int argc _GL_UNUSED, char *argv[])
         size_t q_len = 1024;
         char *q = malloc (q_len + 1);
         char buf[10];
-        memset (q, 'Q', q_len);
-        q[q_len] = 0;
 
         /* Z points to the boundary between a readable/writable page
            and one that is neither readable nor writable.  Position
            our string so its NUL is at the end of the writable one.  */
         char const *str = "____";
         size_t s_len = strlen (str);
+		size_t n;
+
+        memset (q, 'Q', q_len);
+        q[q_len] = 0;
         z -= s_len + 1;
         memcpy (z, str, s_len + 1);
 
@@ -324,7 +326,7 @@ main (int argc _GL_UNUSED, char *argv[])
         /* Whether this actually triggers a SEGV depends on the
            implementation of memcmp: whether it compares only byte-at-
            a-time, and from left to right (no SEGV) or some other way.  */
-        size_t n = quotearg_buffer (buf, sizeof buf, z, SIZE_MAX, NULL);
+        n = quotearg_buffer (buf, sizeof buf, z, SIZE_MAX, NULL);
         ASSERT (n == s_len + 2 * q_len);
         ASSERT (memcmp (buf, q, sizeof buf) == 0);
         free (q);
-- 
1.8.3.4

