diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-08-02 08:58:48 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-08-02 08:58:48 +0000 |
commit | 3a6d7bc4bc41d4ebbd74f149130d054f6bcb942c (patch) | |
tree | ccd1258874f894441b0bb8dcf88e738148daa763 | |
parent | 7b1f86886de719653324e1fa02f55271fd6b2234 (diff) |
mplibdir: Drop replacement function for snprintf()
git-svn-id: svn://tug.org/texlive/trunk@27284 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/c-auto.in | 3 | ||||
-rwxr-xr-x | Build/source/texk/web2c/configure | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/configure.ac | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mp.w | 156 |
6 files changed, 10 insertions, 161 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index f254c32ee5d..2471866718e 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,7 @@ +2012-08-01 Peter Breitenlohner <peb@mppmu.mpg.de> + + * configure.ac (AC_CHECK_FUNCS): Remove test for snprintf. + 2012-07-19 Peter Breitenlohner <peb@mppmu.mpg.de> * w2c/config.h: Define LONGINTEGER_PRI instead of diff --git a/Build/source/texk/web2c/c-auto.in b/Build/source/texk/web2c/c-auto.in index 1dc2899d014..24e504793d8 100644 --- a/Build/source/texk/web2c/c-auto.in +++ b/Build/source/texk/web2c/c-auto.in @@ -161,9 +161,6 @@ /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure index 702a4112810..fd54888a023 100755 --- a/Build/source/texk/web2c/configure +++ b/Build/source/texk/web2c/configure @@ -20400,7 +20400,7 @@ if test "$ac_res" != no; then : fi -for ac_func in access atoi fmax ftime gettimeofday mkdtemp setlocale snprintf strerror strlcat strlcpy +for ac_func in access atoi fmax ftime gettimeofday mkdtemp setlocale strerror strlcat strlcpy do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" diff --git a/Build/source/texk/web2c/configure.ac b/Build/source/texk/web2c/configure.ac index 5b9fb2098bf..2bdf43f75fa 100644 --- a/Build/source/texk/web2c/configure.ac +++ b/Build/source/texk/web2c/configure.ac @@ -250,7 +250,7 @@ if test $ac_cv_sizeof_int -lt 4; then fi AC_CHECK_SIZEOF([long]) AC_SEARCH_LIBS([pow], [m]) -AC_CHECK_FUNCS([access atoi fmax ftime gettimeofday mkdtemp setlocale snprintf strerror strlcat strlcpy]) +AC_CHECK_FUNCS([access atoi fmax ftime gettimeofday mkdtemp setlocale strerror strlcat strlcpy]) AC_CHECK_HEADERS([errno.h langinfo.h locale.h sys/time.h sys/timeb.h sys/wait.h time.h]) AC_TYPE_LONG_DOUBLE AC_TYPE_LONG_LONG_INT diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index 3a12a9e2238..5b1cb946d91 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,7 @@ +2012-08-01 Peter Breitenlohner <peb@mppmu.mpg.de> + + * mp.w: Drop replacement function for snprintf(). + 2012-07-28 Peter Breitenlohner <peb@mppmu.mpg.de> * am/mplib.am (nodist_libmplib_a_SOURCES): Omit $(tfmin_c_h). diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index 1bf72630447..af5230845a0 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -2793,163 +2793,7 @@ char *mp_xstrdup (MP mp, const char *s) { @ @<Internal library declarations@>= -#ifdef HAVE_SNPRINTF # define mp_snprintf (void)snprintf -#else -static void mp_snprintf (char *str, int size, const char *fmt, ...); -#endif - -@ This internal version is rather stupid, but good enough for its purpose. - -@c -#ifndef HAVE_SNPRINTF -static char *mp_itoa (int i) { - char res[32]; - unsigned idx = 30; - unsigned v = (unsigned) abs (i); - memset (res, 0, 32 * sizeof (char)); - while (v >= 10) { - char d = (char) (v % 10); - v = v / 10; - res[idx--] = (char) (d + '0'); - } - res[idx--] = (char) (v + '0'); - if (i < 0) { - res[idx--] = '-'; - } - return mp_strdup ((res + idx + 1)); -} -static char *mp_utoa (unsigned v) { - char res[32]; - unsigned idx = 30; - memset (res, 0, 32 * sizeof (char)); - while (v >= 10) { - char d = (char) (v % 10); - v = v / 10; - res[idx--] = (char) (d + '0'); - } - res[idx--] = (char) (v + '0'); - return mp_strdup ((res + idx + 1)); -} -static void mp_snprintf (char *str, int size, const char *format, ...) { - const char *fmt; - char *res; - int fw, pad; - va_list ap; - va_start (ap, format); - res = str; - for (fmt = format; *fmt != '\0'; fmt++) { - if (*fmt == '%') { - fw = 0; - pad = 0; - RESTART: - fmt++; - switch (*fmt) { - case '0': - pad = 1; - goto RESTART; - break; - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - assert (fw == 0); - fw = *fmt - '0'; - goto RESTART; - break; - case 's': - { - char *s = va_arg (ap, char *); - while (*s) { - *res = *s++; - if (size-- > 0) - res++; - } - } - break; - case 'c': - { - int s = va_arg (ap, int); - *res = (char) s; - if (size-- > 0) - res++; - } - break; - case 'i': - case 'd': - { - char *sstart, *s = mp_itoa (va_arg (ap, int)); - sstart = s; - if (fw) { - int ffw = fw - (int) strlen (s); - while (ffw-- > 0) { - *res = (char) (pad ? '0' : ' '); - if (size-- > 0) - res++; - } - } - if (s != NULL) { - while (*s) { - *res = *s++; - if (size-- > 0) - res++; - } - mp_xfree (sstart); - } - } - break; - case 'u': - { - char *sstart, *s = mp_utoa (va_arg (ap, unsigned)); - sstart = s; - if (fw) { - int ffw = fw - (int) strlen (s); - while (ffw-- > 0) { - *res = (char) (pad ? '0' : ' '); - if (size-- > 0) - res++; - } - } - if (s != NULL) { - while (*s) { - *res = *s++; - if (size-- > 0) - res++; - } - mp_xfree (sstart); - } - } - break; - case '%': - *res = '%'; - if (size-- > 0) - res++; - break; - default: - *res = '%'; - if (size-- > 0) - res++; - *res = *fmt; - if (size-- > 0) - res++; - break; - } - } else { - *res = *fmt; - if (size-- > 0) - res++; - } - } - *res = '\0'; - va_end (ap); -} -#endif - @* Dynamic memory allocation. |