[Pinfo-devel] r168 - in pinfo/branches/cxx: . macros src
Nathanael Nerode
neroden-guest at costa.debian.org
Sun Sep 4 09:50:17 UTC 2005
Author: neroden-guest
Date: 2005-09-04 09:50:16 +0000 (Sun, 04 Sep 2005)
New Revision: 168
Removed:
pinfo/branches/cxx/src/snprintf.cxx
Modified:
pinfo/branches/cxx/TODO
pinfo/branches/cxx/configure.ac
pinfo/branches/cxx/macros/Makefile.in
pinfo/branches/cxx/src/Makefile.am
pinfo/branches/cxx/src/manual.cxx
Log:
Statically allocate a buffer large enough for any possible result
in check_manwidth. This allows the elimination of the final
instance of snprintf in the codebase, so eliminate snprintf.cxx
and all references to it. Whee.
Also, eliminate a now-irrelevant TODO item.
Modified: pinfo/branches/cxx/TODO
===================================================================
--- pinfo/branches/cxx/TODO 2005-09-04 09:22:49 UTC (rev 167)
+++ pinfo/branches/cxx/TODO 2005-09-04 09:50:16 UTC (rev 168)
@@ -2,8 +2,6 @@
add search backwards
-change tempnam->mkstemp
-
Wojciech Filipczyk patch
Christian's bugreport
Modified: pinfo/branches/cxx/configure.ac
===================================================================
--- pinfo/branches/cxx/configure.ac 2005-09-04 09:22:49 UTC (rev 167)
+++ pinfo/branches/cxx/configure.ac 2005-09-04 09:50:16 UTC (rev 168)
@@ -70,8 +70,7 @@
# Checks for library functions.
AC_CHECK_FUNCS(strdup strstr strsep)
-AC_CHECK_FUNCS(getopt_long snprintf)
-AM_CONDITIONAL(HAVE_SNPRINTF,test "x$ac_cv_func_snprintf" = "xyes")
+AC_CHECK_FUNCS(getopt_long)
AC_CHECK_FUNC(sigblock,,AC_CHECK_LIB(bsd, sigblock))
if test "x$ac_cv_lib_bsd_sigblock" = "xyes" -o \
Modified: pinfo/branches/cxx/macros/Makefile.in
===================================================================
--- pinfo/branches/cxx/macros/Makefile.in 2005-09-04 09:22:49 UTC (rev 167)
+++ pinfo/branches/cxx/macros/Makefile.in 2005-09-04 09:50:16 UTC (rev 168)
@@ -110,8 +110,6 @@
HAVE_SIGBLOCK_FALSE = @HAVE_SIGBLOCK_FALSE@
HAVE_SIGBLOCK_TRUE = @HAVE_SIGBLOCK_TRUE@
HAVE_SNPRINTF = @HAVE_SNPRINTF@
-HAVE_SNPRINTF_FALSE = @HAVE_SNPRINTF_FALSE@
-HAVE_SNPRINTF_TRUE = @HAVE_SNPRINTF_TRUE@
HAVE_WPRINTF = @HAVE_WPRINTF@
INSIDE_GNOME_COMMON_FALSE = @INSIDE_GNOME_COMMON_FALSE@
INSIDE_GNOME_COMMON_TRUE = @INSIDE_GNOME_COMMON_TRUE@
Modified: pinfo/branches/cxx/src/Makefile.am
===================================================================
--- pinfo/branches/cxx/src/Makefile.am 2005-09-04 09:22:49 UTC (rev 167)
+++ pinfo/branches/cxx/src/Makefile.am 2005-09-04 09:50:16 UTC (rev 168)
@@ -36,15 +36,8 @@
tmpfiles.h \
localestuff.h
-pinfo_SNPRINTF = snprintf.cxx # snprintf.h
pinfo_SIGBLOCK = sigblock.cxx sigblock.h
-if HAVE_SNPRINTF
-pinfo_SNPRINTF_OBJ =
-else
-pinfo_SNPRINTF_OBJ = snprintf.o
-endif
-
if HAVE_SIGBLOCK
pinfo_SIGBLOCK_OBJ =
else
@@ -55,18 +48,11 @@
INCLUDES = @READLINE_INCLUDES@
-pinfo_LDADD = $(pinfo_SNPRINTF_OBJ)\
- $(pinfo_SIGBLOCK_OBJ) @READLINE_LIBS@ $(INTLLIBS)
+pinfo_LDADD = $(pinfo_SIGBLOCK_OBJ) @READLINE_LIBS@ $(INTLLIBS)
-pinfo_DEPENDENCIES = $(pinfo_SNPRINTF_OBJ)\
- $(pinfo_SIGBLOCK_OBJ)\
+pinfo_DEPENDENCIES = $(pinfo_SIGBLOCK_OBJ)\
$(INTLDEPS)
-if HAVE_SNPRINTF
-else
-snprintf.o: $(pinfo_SNPRINTF)
-endif
-
if HAVE_SIGBLOCK
else
sigblock.o: $(pinfo_SIGBLOCK)
@@ -82,5 +68,5 @@
echo "WARNING! Old pinforc detected. I'm not installing the new file"; \
fi
-EXTRA_DIST = $(pinfo_SNPRINTF) $(pinfo_SIGBLOCK)
+EXTRA_DIST = $(pinfo_SIGBLOCK)
Modified: pinfo/branches/cxx/src/manual.cxx
===================================================================
--- pinfo/branches/cxx/src/manual.cxx 2005-09-04 09:22:49 UTC (rev 167)
+++ pinfo/branches/cxx/src/manual.cxx 2005-09-04 09:50:16 UTC (rev 168)
@@ -123,15 +123,24 @@
* $MANWIDTH was changed by pinfo */
static bool manwidthChanged = false;
-/* Set MANWIDTH as needed */
+/* Set MANWIDTH environment variable as needed */
void
check_manwidth(void) {
if ((!getenv("MANWIDTH")) ||(manwidthChanged))
{
- /* set MANWIDTH environment variable */
- static char tmp[24];
- snprintf(tmp, 24, "MANWIDTH=%d", maxx);
- putenv(tmp);
+ /* This should be rewritten dynamically,
+ * but putenv sucks really badly, and setenv isn't portable,
+ * so for now we leave it. FIXME.
+ */
+ /* x is an int. int is no larger than 64 bits (we hope).
+ * The largest value in a signed 64-bit integer is 2^63 - 1
+ * which can be represented in 19 digits. Therefore 29
+ * characters is enough to include the whole string (with
+ * terminator), and sprintf is safe. Whee.
+ */
+ static char env_entry[30];
+ sprintf(env_entry, "MANWIDTH=%d", maxx);
+ putenv(env_entry);
manwidthChanged = true;
}
}
Deleted: pinfo/branches/cxx/src/snprintf.cxx
More information about the Pinfo-devel
mailing list