]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Use countof, part 1.
authorBruno Haible <bruno@clisp.org>
Mon, 11 May 2026 23:59:38 +0000 (01:59 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 11 May 2026 23:59:38 +0000 (01:59 +0200)
* libtextstyle/gnulib-local/build-aux/moopp (func_emit_source_c): Emit a
'#include <stdcountof.h>' and uses of countof.

libtextstyle/gnulib-local/build-aux/moopp

index 3f4503195478091fdd2628616f870ae4ad1627b5..884b6984475d979893dde81b72d3df4d47e02247 100755 (executable)
@@ -633,6 +633,7 @@ func_emit_source_c ()
       echo "#define super ${main_superclassname}_vtable"
       echo
     fi
+    echo "#include <stdcountof.h>"
     echo "#line "`expr $impl_end_lineno + 1`" \"${source_impl_file_base}\""
     cat "$source_impl_file" | sed -e "1,${impl_end_lineno}d" | sed -e "s,${main_classname}::,${main_classname}__,g"
     echo
@@ -689,7 +690,7 @@ func_emit_source_c ()
     echo "const struct ${main_classname}_implementation ${main_classname}_vtable ="
     echo "{"
     echo "  ${main_classname}_superclasses,"
-    echo "  sizeof (${main_classname}_superclasses) / sizeof (${main_classname}_superclasses[0]),"
+    echo "  countof (${main_classname}_superclasses),"
     echo "  sizeof (struct ${main_classname}_representation),"
     echo "$all_methods" | sed -e "$sed_remove_empty_lines" |
       while read method; do