]> git.draconx.ca Git - rrace.git/commitdiff
Replace Gnulib striconv with copyright_symbol from dxcommon.
authorNick Bowler <nbowler@draconx.ca>
Sun, 28 May 2023 20:20:13 +0000 (16:20 -0400)
committerNick Bowler <nbowler@draconx.ca>
Mon, 29 May 2023 00:50:42 +0000 (20:50 -0400)
The only use of the striconv module is to produce the copyright symbol
for --version output and the about dialog in the Motif GUI.  Using the
new, single-purpose function reduces code size quite a bit.

Makefile.am
bootstrap
common
configure.ac
m4/gnulib-cache.m4
src/version.c

index 2e0db6bf2b7185d312c97aa76ce7922ddfe3d23d..e8f3c8fa1ad5f4e4eb307b8440df730a437a86cc 100644 (file)
@@ -19,8 +19,7 @@ AM_CPPFLAGS = -I$(builddir)/src -I$(srcdir)/src -I$(DX_BASEDIR)/src \
 AM_CFLAGS = $(CURSES_CFLAGS) $(MOTIF_CFLAGS)
 
 GNULIB = libgnu.a $(LIB_CLOCK_GETTIME) $(LIB_GETHRXTIME) $(LIB_HARD_LOCALE) \
-         $(LIB_MBRTOWC) $(LIB_SETLOCALE_NULL) $(LTLIBICONV) $(LTLIBINTL) \
-         $(LTLIBUNISTRING)
+         $(LIB_MBRTOWC) $(LIB_SETLOCALE_NULL) $(LTLIBINTL) $(LTLIBUNISTRING)
 LDADD = $(GNULIB)
 
 if HAVE_CURSES
@@ -67,6 +66,11 @@ libglohelp_a_CFLAGS = -DHELP_GETOPT_LONG_ONLY
 $(libglohelp_a_OBJECTS): $(gnulib_headers)
 libglohelp_a_SHORTNAME = glo
 
+if USE_NLS
+rrace_curses_SOURCES += common/src/copysym.c
+rrace_motif_SOURCES += common/src/copysym.c
+endif
+
 OPTFILES = src/cursesopt.opt src/motifopt.opt
 .opt.h:
        $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
index f16d302fe3ead70c7c6301fc0ede7593e3d78f12..7bb1f8dc9aef98382f6a775fdb7f9e18cccd2e97 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright © 2011-2012, 2015, 2021-2022 Nick Bowler
+# Copyright © 2011-2012, 2015, 2021-2023 Nick Bowler
 #
 # Simple script to get started from a fresh git checkout.
 #
@@ -10,8 +10,8 @@
 
 scriptname=$0
 
-err() { printf '%s: %s\n' "$scriptname" "$*" 1>&2; }
-die() { err "$@"; exit 1; }
+err () { printf '%s: %s\n' "$scriptname" "$*" 1>&2; }
+die () { err "$@"; exit 1; }
 
 : ${AUTORECONF=autoreconf}
 : ${AUTOMAKE=automake}
@@ -23,6 +23,7 @@ $GIT submodule update --init || err "Failed to update submodules from git."
 
 if test -x $GNULIB/gnulib-tool; then
   $GNULIB/gnulib-tool --update -S || die "Failed to update Gnulib."
+  $GNULIB/gnulib-tool --copy-file -S build-aux/config.rpath config.rpath
 else
   err "Gnulib sources are not properly installed in $GNULIB/"
   cat >&2 <<'EOF'
diff --git a/common b/common
index 70c84546fa5ecaba26e4ed021b292a5580f304f0..207d0dbfbbfa7ad70b59ada3a741895842958885 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 70c84546fa5ecaba26e4ed021b292a5580f304f0
+Subproject commit 207d0dbfbbfa7ad70b59ada3a741895842958885
index 7239adb779f9dffae830d988de3f4cf98f089290..11b12933c7a3584b5c27419ed32c4c0d6f5b58f7 100644 (file)
@@ -168,6 +168,8 @@ AS_IF([test x"$dx_cv_xpm_to_png" = x"gm convert"],
 AC_CHECK_PROGS([OPTIPNG], [optipng])
 : "${OPTIPNG:=:}"
 
+AM_CONDITIONAL([USE_NLS], [test x"$USE_NLS" = x"yes"])
+
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 
index a23b145ac55fd1718c146435f7a1f637d1c4f12a..d29c1daf08f54c286a79de7b37967cd91f1f5e78 100644 (file)
@@ -45,8 +45,7 @@
 #  gettext-h \
 #  inline \
 #  localcharset \
-#  mbswidth \
-#  striconv
+#  mbswidth
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
@@ -57,7 +56,6 @@ gl_MODULES([
   inline
   localcharset
   mbswidth
-  striconv
 ])
 gl_AVOID([std-gnu11])
 gl_SOURCE_BASE([lib])
index de174b554e1f1ca5435c1ddf7428de3cd2b397f1..5708c0ce335c41b173785e27e14790ef62f1fa14 100644 (file)
 
 #include <config.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <stdarg.h>
-#include <striconv.h>
 #include <localcharset.h>
 
 #include "version.h"
-
-const char *init_copysign(char **alloc)
-{
-       *alloc = NULL;
-
-       if (ENABLE_NLS) {
-               char *buf = str_iconv("\xc2\xa9", "UTF-8", locale_charset());
-               if (buf)
-                       return *alloc = buf;
-       }
-
-       return "(C)";
-}
+#include "copysym.h"
 
 #define VERSION_HEAD_FMT "%s (RRace) %s\nCopyright %s 2023 Nick Bowler"
 #define VERSION_HEAD_ARGS progname, PACKAGE_VERSION, copysign
 
 void version_print_head(const char *progname, FILE *f)
 {
-       const char *copysign;
-       char *copybuf;
-
-       copysign = init_copysign(&copybuf);
+       const char *copysign = copyright_symbol(locale_charset());
 
        printf(VERSION_HEAD_FMT, VERSION_HEAD_ARGS);
        putc('\n', f);
-
-       free(copybuf);
 }
 
 char *version_format_head(const char *progname)
 {
-       const char *copysign;
-       char *copybuf, *ret;
-
-       copysign = init_copysign(&copybuf);
+       const char *copysign = copyright_symbol(locale_charset());
+       char *ret;
 
        ret = malloc(sizeof VERSION_HEAD_FMT + 100);
        if (ret)
                sprintf(ret, VERSION_HEAD_FMT, VERSION_HEAD_ARGS);
 
-       free(copybuf);
        return ret;
 }