[tex-live] portability issue in texmfmp.c

Jonathan Kew jonathan_kew at sil.org
Fri Dec 29 19:54:30 CET 2006

Hi Martin -

I noticed the following in your rev. 2997:

Index: lib/texmfmp.c
--- lib/texmfmp.c	(revision 2996)
+++ lib/texmfmp.c	(revision 2997)
@@ -1958,7 +1958,7 @@
gettexstring P1C(strnumber, s)
-  poolpointer i, len;
+  poolpointer len;
    string name;
#if !defined(Omega) && !defined(eOmega) && !defined(Aleph) && !defined 
    len = strstart[s + 1] - strstart[s];
@@ -1969,6 +1969,7 @@
#if !defined(Omega) && !defined(eOmega) && !defined(Aleph) && !defined 
    strncpy (name, (string)&strpool[strstart[s]], len);
+  poolpointer i;
    /* Don't use strncpy.  The strpool is not made up of chars. */
    for (i=0; i<len; i++) name[i] =  strpool[i+strstartar[s - 65536L]];

I believe this will cause problems, because puts the declaration  
"poolpointer i;" after a statement. This is legal in C++ and C99, but  
not in more traditional C, and some current compilers will reject it.  
(gcc accepts it, though I suppose if one used the -ansi and perhaps - 
pedantic options, it might complain.)

Possible solutions include adding braces around the declaration and  
following for-loop, or moving the declaration to the beginning of the  
first #else in the function, so that it stays before any statements.  
(Though looks a little odd there, IMO.)

I haven't checked in a change to this; maybe you could choose how  
you'd like to adjust it?


More information about the tex-live mailing list