]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
lisp-format, scheme-format: Fix a loop transformation.
authorBruno Haible <bruno@clisp.org>
Tue, 14 Mar 2023 01:41:27 +0000 (02:41 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 14 Mar 2023 01:57:28 +0000 (02:57 +0100)
* gettext-tools/src/format-lisp.c (rotate_loop): Assign the new
list->repeated.count.
* gettext-tools/src/format-scheme.c (rotate_loop): Likewise.
* gettext-tools/tests/xgettext-lisp-6: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add it.

gettext-tools/src/format-lisp.c
gettext-tools/src/format-scheme.c
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-lisp-6 [new file with mode: 0755]

index d89746b76b8292add0b2e16e0997d95dc9d39b04..81e89f3a17c977197cedcca1103476f0a0cd1c27 100644 (file)
@@ -776,6 +776,7 @@ rotate_loop (struct format_arg_list *list, unsigned int m)
             }
           free (list->repeated.element);
           list->repeated.element = newelement;
+          list->repeated.count = newcount;
         }
     }
 }
index 90aa3aa93c68b8a856ad3e57719a07199a204dbe..4964644b47e832ef0322b50aa21ada0987f886ff 100644 (file)
@@ -779,6 +779,7 @@ rotate_loop (struct format_arg_list *list, unsigned int m)
             }
           free (list->repeated.element);
           list->repeated.element = newelement;
+          list->repeated.count = newcount;
         }
     }
 }
index 2edb31138743ba729318d39c25a9bd33de580802..0da888ab1c0eebf3c6dfc7b1e69c5de569ea2448 100644 (file)
@@ -122,7 +122,7 @@ TESTS = gettext-1 gettext-2 \
        xgettext-librep-1 xgettext-librep-2 xgettext-librep-3 \
        xgettext-librep-stackovfl-1 xgettext-librep-stackovfl-2 \
        xgettext-lisp-1 xgettext-lisp-2 xgettext-lisp-3 xgettext-lisp-4 \
-       xgettext-lisp-5 \
+       xgettext-lisp-5 xgettext-lisp-6 \
        xgettext-lisp-stackovfl-1 xgettext-lisp-stackovfl-2 \
        xgettext-lua-1 xgettext-lua-2 xgettext-lua-3 \
        xgettext-lua-stackovfl-1 xgettext-lua-stackovfl-2 \
diff --git a/gettext-tools/tests/xgettext-lisp-6 b/gettext-tools/tests/xgettext-lisp-6
new file mode 100755 (executable)
index 0000000..bcfbff7
--- /dev/null
@@ -0,0 +1,24 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test Lisp support: lisp-format string with initial arguments and a loop.
+
+cat <<EOF > xg-ls-6.lisp
+(gettext "~{~}~^~:*~@{~,v*~w~}")
+EOF
+
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location -d xg-ls-6.tmp xg-ls-6.lisp || Exit 1
+LC_ALL=C tr -d '\r' < xg-ls-6.tmp.po > xg-ls-6.po || Exit 1
+
+cat <<EOF > xg-ls-6.ok
+#, lisp-format
+msgid "~{~}~^~:*~@{~,v*~w~}"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-ls-6.ok xg-ls-6.po
+result=$?
+
+exit $result