From 9c92060f5e2f4a0313eff1aa826af43b7900ba2e Mon Sep 17 00:00:00 2001 From: Taco Hoekwater <taco@elvenkind.com> Date: Thu, 5 May 2011 11:31:30 +0000 Subject: [PATCH] latest mp changes from PEB --- source/texk/web2c/mplibdir/ChangeLog | 7 +++++++ source/texk/web2c/mplibdir/mp.w | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source/texk/web2c/mplibdir/ChangeLog b/source/texk/web2c/mplibdir/ChangeLog index ae4323e96..18c5b2b86 100644 --- a/source/texk/web2c/mplibdir/ChangeLog +++ b/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,10 @@ +2011-04-29 Peter Breitenlohner <peb@mppmu.mpg.de> + + * mp.w (mp_do_snprintf): Removed, instead declare and define + static internal version of mp_snprintf(). + Compare change from 2009-12-05: + FIXME: Should unconditionally assume snprintf() exists. + 2011-04-06 Peter Breitenlohner <peb@mppmu.mpg.de> * am/libmplib.am: Only one rule for tfmin.w => tfmin.c. diff --git a/source/texk/web2c/mplibdir/mp.w b/source/texk/web2c/mplibdir/mp.w index 71ed00337..3474fd138 100644 --- a/source/texk/web2c/mplibdir/mp.w +++ b/source/texk/web2c/mplibdir/mp.w @@ -1,4 +1,4 @@ -% $Id: mp.w 1599 2011-04-05 14:15:45Z taco $ +% $Id: mp.w 1668 2011-05-05 09:54:59Z taco $ % % Copyright 2008-2011 Taco Hoekwater. % @@ -2727,7 +2727,6 @@ extern void *mp_xrealloc (MP mp, void *p, size_t nmem, size_t size); extern void *mp_xmalloc (MP mp, size_t nmem, size_t size); extern char *mp_xstrdup (MP mp, const char *s); extern char *mp_xstrldup (MP mp, const char *s, size_t l); -extern void mp_do_snprintf (char *str, int size, const char *fmt, ...); @ Some care has to be taken while copying strings @@ -2813,12 +2812,13 @@ char *mp_xstrdup (MP mp, const char *s) { #ifdef HAVE_SNPRINTF # define mp_snprintf (void)snprintf #else -# define mp_snprintf mp_do_snprintf +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; @@ -2847,7 +2847,7 @@ static char *mp_utoa (unsigned v) { res[idx--] = (char) (v + '0'); return mp_strdup ((res + idx + 1)); } -void mp_do_snprintf (char *str, int size, const char *format, ...) { +static void mp_snprintf (char *str, int size, const char *format, ...) { const char *fmt; char *res; int fw, pad; @@ -2964,6 +2964,7 @@ void mp_do_snprintf (char *str, int size, const char *format, ...) { *res = '\0'; va_end (ap); } +#endif @* Dynamic memory allocation. -- GitLab