From 0e7550a0de00291bf3a50ed57dff573524e169f6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 10 Nov 2010 01:47:02 +0000 Subject: avoid unportable passing of vararg list, http://bugs.debian.org/602566 git-svn-id: svn://tug.org/texlive/trunk@20390 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 7 +++++++ Build/source/texk/kpathsea/tex-file.c | 21 ++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 01c1489ae58..dbcad333246 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,10 @@ +2010-11-10 Mathias Kende + + * tex-file.c (kpathsea_set_suffixes_va_list): new fn. + (kpse_set_suffixes, kpathsea_set_suffixes): call it. + Avoids passing variable argument list, which is not portable. + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602566 + 2010-11-07 Karl Berry * cnf.c (do_line): remove trailing comment and preceding diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index 7e5d501e32b..3370186d6a9 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -320,14 +320,13 @@ init_path (kpathsea kpse, kpse_format_info_type *info, /* Some file types have more than one suffix, and sometimes it is convenient to modify the list of searched suffixes. */ -void -kpathsea_set_suffixes (kpathsea kpse, kpse_file_format_type format, - boolean alternate, ...) +static void +kpathsea_set_suffixes_va_list (kpathsea kpse, kpse_file_format_type format, + boolean alternate, va_list ap) { const_string **list; const_string s; int count = 0; - va_list ap; if (alternate) { list = &(kpse->format_info[format].alt_suffix); @@ -335,16 +334,24 @@ kpathsea_set_suffixes (kpathsea kpse, kpse_file_format_type format, list = &(kpse->format_info[format].suffix); } - va_start (ap, alternate); while ((s = va_arg (ap, string)) != NULL) { count++; XRETALLOC (*list, count + 1, const_string); (*list)[count - 1] = s; } - va_end (ap); (*list)[count] = NULL; } +void +kpathsea_set_suffixes (kpathsea kpse, kpse_file_format_type format, + boolean alternate, ...) +{ + va_list ap; + va_start (ap, alternate); + kpathsea_set_suffixes_va_list (kpse, format, alternate, ap); + va_end (ap); +} + #if defined (KPSE_COMPAT_API) void @@ -353,7 +360,7 @@ kpse_set_suffixes (kpse_file_format_type format, { va_list ap; va_start (ap, alternate); - kpathsea_set_suffixes (kpse_def, format, alternate, ap); + kpathsea_set_suffixes_va_list (kpse_def, format, alternate, ap); va_end (ap); } #endif -- cgit v1.2.3