diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2013-06-28 06:17:11 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2013-06-28 06:17:11 +0000 |
commit | d255e898b99b63f264f3a3848a0cfe80473b4c84 (patch) | |
tree | 3566826ff4a05d51e97c8fe9378d72b74062c909 /Build/source | |
parent | 0277c6bc6f2dd4647bc8a7e14640bdf262a45a34 (diff) |
Replace BSD string functions (removed in POSIX.1-2008) by SYSV/ANSI equivalents
git-svn-id: svn://tug.org/texlive/trunk@30997 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
19 files changed, 107 insertions, 29 deletions
diff --git a/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog b/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog index b979ffb58a3..8ec8c93eaef 100644 --- a/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog +++ b/Build/source/texk/detex/detex-2.8-PATCHES/ChangeLog @@ -1,3 +1,8 @@ +2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + patch-10-ANSI (new): Replace index() => strchr() and + rindex() => strrchr(). + 2012-08-24 Peter Breitenlohner <peb@mppmu.mpg.de> * patch-08-kpathsea (new): Use kpse_program_name. diff --git a/Build/source/texk/detex/detex-2.8-PATCHES/patch-10-ANSI-strings b/Build/source/texk/detex/detex-2.8-PATCHES/patch-10-ANSI-strings new file mode 100644 index 00000000000..8f03d7b26af --- /dev/null +++ b/Build/source/texk/detex/detex-2.8-PATCHES/patch-10-ANSI-strings @@ -0,0 +1,52 @@ +diff -ur detex-2.8.orig/detex.l detex-2.8/detex.l +--- detex-2.8.orig/detex.l 2012-08-24 10:51:12.000000000 +0200 ++++ detex-2.8/detex.l 2013-06-27 18:49:05.000000000 +0200 +@@ -70,10 +70,10 @@ + + #ifdef HAVE_STRING_H + #include <string.h> +-#define index strchr +-#define rindex strrchr + #else + #include <strings.h> ++#define strchr index ++#define strrchr rindex + #endif + #ifndef MAXPATHLEN + #include <sys/param.h> +@@ -445,7 +445,7 @@ + kpse_set_program_name (rgsbArgs[0], NULL); + sbProgName = kpse_program_name; + #else +- if ((sbProgName = rindex(rgsbArgs[0], '/')) != NULL) ++ if ((sbProgName = strrchr(rgsbArgs[0], '/')) != NULL) + sbProgName++; + else + sbProgName = rgsbArgs[0]; +@@ -701,7 +701,7 @@ + if (csbIncList == 0) /* no list */ + return(1); + (void)strcpy(sbBase, sbFile); +- if ((pch = rindex(sbBase, '.')) != NULL) ++ if ((pch = strrchr(sbBase, '.')) != NULL) + *pch = '\0'; + i = 0; + while ((i < csbIncList) && rgsbIncList[i]) +@@ -770,7 +770,7 @@ + + while (sbList && *sbList && csbList < csbMax) { + rgsbList[csbList++] = sbList; +- if ((sbList = index(sbList, chSep))) ++ if ((sbList = strchr(sbList, chSep))) + *sbList++ = '\0'; + } + return(sbList && *sbList ? my_ERROR : csbList); +@@ -815,7 +815,7 @@ + #endif + + /* If sbFile ends in .tex then it must be there */ +- if ((pch = rindex(sbFullPath, '.')) != NULL ++ if ((pch = strrchr(sbFullPath, '.')) != NULL + && (strcmp(pch, ".tex") == 0)) + { + if ((fp = fopen(sbFullPath, "r")) != NULL) diff --git a/Build/source/texk/detex/detex-2.8/detex.c b/Build/source/texk/detex/detex-2.8/detex.c index c6114c5b71d..58188654f02 100644 --- a/Build/source/texk/detex/detex-2.8/detex.c +++ b/Build/source/texk/detex/detex-2.8/detex.c @@ -1531,10 +1531,10 @@ static char rcsid[] = "$Header: /p/src/local/bin/detex/RCS/detex.l,v 2.22 2007/0 #ifdef HAVE_STRING_H #include <string.h> -#define index strchr -#define rindex strrchr #else #include <strings.h> +#define strchr index +#define strrchr rindex #endif #ifndef MAXPATHLEN #include <sys/param.h> @@ -3759,7 +3759,7 @@ main(int cArgs, char *rgsbArgs[]) kpse_set_program_name (rgsbArgs[0], NULL); sbProgName = kpse_program_name; #else - if ((sbProgName = rindex(rgsbArgs[0], '/')) != NULL) + if ((sbProgName = strrchr(rgsbArgs[0], '/')) != NULL) sbProgName++; else sbProgName = rgsbArgs[0]; @@ -4015,7 +4015,7 @@ InList(char *sbFile) if (csbIncList == 0) /* no list */ return(1); (void)strcpy(sbBase, sbFile); - if ((pch = rindex(sbBase, '.')) != NULL) + if ((pch = strrchr(sbBase, '.')) != NULL) *pch = '\0'; i = 0; while ((i < csbIncList) && rgsbIncList[i]) @@ -4084,7 +4084,7 @@ SeparateList(char *sbList, char *rgsbList[], char chSep, int csbMax) while (sbList && *sbList && csbList < csbMax) { rgsbList[csbList++] = sbList; - if ((sbList = index(sbList, chSep))) + if ((sbList = strchr(sbList, chSep))) *sbList++ = '\0'; } return(sbList && *sbList ? my_ERROR : csbList); @@ -4129,7 +4129,7 @@ TexOpen(char *sbFile) #endif /* If sbFile ends in .tex then it must be there */ - if ((pch = rindex(sbFullPath, '.')) != NULL + if ((pch = strrchr(sbFullPath, '.')) != NULL && (strcmp(pch, ".tex") == 0)) { if ((fp = fopen(sbFullPath, "r")) != NULL) diff --git a/Build/source/texk/detex/detex-2.8/detex.l b/Build/source/texk/detex/detex-2.8/detex.l index aab1d7096ef..23c22e35f69 100644 --- a/Build/source/texk/detex/detex-2.8/detex.l +++ b/Build/source/texk/detex/detex-2.8/detex.l @@ -70,10 +70,10 @@ static char rcsid[] = "$Header: /p/src/local/bin/detex/RCS/detex.l,v 2.22 2007/0 #ifdef HAVE_STRING_H #include <string.h> -#define index strchr -#define rindex strrchr #else #include <strings.h> +#define strchr index +#define strrchr rindex #endif #ifndef MAXPATHLEN #include <sys/param.h> @@ -445,7 +445,7 @@ main(int cArgs, char *rgsbArgs[]) kpse_set_program_name (rgsbArgs[0], NULL); sbProgName = kpse_program_name; #else - if ((sbProgName = rindex(rgsbArgs[0], '/')) != NULL) + if ((sbProgName = strrchr(rgsbArgs[0], '/')) != NULL) sbProgName++; else sbProgName = rgsbArgs[0]; @@ -701,7 +701,7 @@ InList(char *sbFile) if (csbIncList == 0) /* no list */ return(1); (void)strcpy(sbBase, sbFile); - if ((pch = rindex(sbBase, '.')) != NULL) + if ((pch = strrchr(sbBase, '.')) != NULL) *pch = '\0'; i = 0; while ((i < csbIncList) && rgsbIncList[i]) @@ -770,7 +770,7 @@ SeparateList(char *sbList, char *rgsbList[], char chSep, int csbMax) while (sbList && *sbList && csbList < csbMax) { rgsbList[csbList++] = sbList; - if ((sbList = index(sbList, chSep))) + if ((sbList = strchr(sbList, chSep))) *sbList++ = '\0'; } return(sbList && *sbList ? my_ERROR : csbList); @@ -815,7 +815,7 @@ TexOpen(char *sbFile) #endif /* If sbFile ends in .tex then it must be there */ - if ((pch = rindex(sbFullPath, '.')) != NULL + if ((pch = strrchr(sbFullPath, '.')) != NULL && (strcmp(pch, ".tex") == 0)) { if ((fp = fopen(sbFullPath, "r")) != NULL) diff --git a/Build/source/texk/gsftopk/ChangeLog b/Build/source/texk/gsftopk/ChangeLog index ffac3b217f5..a17b93c3819 100644 --- a/Build/source/texk/gsftopk/ChangeLog +++ b/Build/source/texk/gsftopk/ChangeLog @@ -1,3 +1,7 @@ +2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + * gsftopk.c: Replace bzero(s, l) => memset(s, 0, l). + 2013-02-08 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am (gsftopkpsheaderdir): Change texmf => texmf-dist. diff --git a/Build/source/texk/gsftopk/gsftopk.c b/Build/source/texk/gsftopk/gsftopk.c index 52c45e5d9f3..1e169887b6c 100644 --- a/Build/source/texk/gsftopk/gsftopk.c +++ b/Build/source/texk/gsftopk/gsftopk.c @@ -1698,7 +1698,7 @@ pk_rll_cvt(void) * Form bit counts and collect statistics */ base = 0; - bzero(deltas, sizeof(deltas)); + memset(deltas, 0, sizeof(deltas)); rowdup = NULL; /* last row checked for duplicates */ p = rowptr = bitmap; mask = 0x80 >> skip; diff --git a/Build/source/texk/makeindexk/ChangeLog b/Build/source/texk/makeindexk/ChangeLog index 7581a9ae3b1..13e15d99cc2 100644 --- a/Build/source/texk/makeindexk/ChangeLog +++ b/Build/source/texk/makeindexk/ChangeLog @@ -1,3 +1,7 @@ +2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + * scanid.c: Replace bzero(s, l) => memset(s, 0, l). + 2013-04-16 Peter Breitenlohner <peb@mppmu.mpg.de> Avoid gcc warning on 64-bit systems. diff --git a/Build/source/texk/makeindexk/scanid.c b/Build/source/texk/makeindexk/scanid.c index 1c126933cc8..ccb1bbd4342 100644 --- a/Build/source/texk/makeindexk/scanid.c +++ b/Build/source/texk/makeindexk/scanid.c @@ -184,7 +184,7 @@ make_key(void) if ((ptr = malloc(len)) == NULL) fprintf (stderr, "Not enough core...abort.\n"); - bzero(ptr, len); + memset(ptr, 0, len); /* Initialize dangling pointers * Note: it would be a nice work to redesign the code to use NULL for * comparision ... nevertheless, using local "" in a global environment @@ -242,7 +242,7 @@ make_string(char **ppstr, int n) (*ppstr) = malloc(n); if (!(*ppstr)) fprintf (stderr, "Not enough core...abort.\n"); - bzero(*ppstr, n); /* Always zero anything, <werner@suse.de> */ + memset(*ppstr, 0, n); /* Always zero anything, <werner@suse.de> */ } static int diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog index c057addacb1..7e538f83cbb 100644 --- a/Build/source/texk/seetexk/ChangeLog +++ b/Build/source/texk/seetexk/ChangeLog @@ -1,3 +1,9 @@ +2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + * dviconcat.c: Replace bcmp() => memcmp(). + * search.c: Replace bcopy(f, t, l) => memcpy(t, f, l) and + bzero(s, l) => memset(s, 0, l). + 2012-11-19 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am: Avoid use of deprecated INCLUDES. diff --git a/Build/source/texk/seetexk/dviconcat.c b/Build/source/texk/seetexk/dviconcat.c index fad8b536f9f..eb1bb828a69 100644 --- a/Build/source/texk/seetexk/dviconcat.c +++ b/Build/source/texk/seetexk/dviconcat.c @@ -102,11 +102,6 @@ i16 DVIStackSize; /* max of all stack sizes */ char writeerr[] = "error writing DVI file"; static void HandleDVIFile(void); -#ifdef _AMIGA -#define bcmp(s1, s2, len) memcmp(s1, s2, len) -#define bzero(s, len) memset(s, '\0', len) -#define index(s, c) strchr(s, c) -#endif /* _AMIGA */ #ifndef KPATHSEA char *malloc(), *realloc(); @@ -516,7 +511,7 @@ HandleFontDef(i32 index) if (fi->fi_designsize == designsize && fi->fi_mag == mag && fi->fi_n1 == n1 && fi->fi_n2 == n2 && - bcmp(fi->fi_name, s, i) == 0) { + memcmp(fi->fi_name, s, i) == 0) { if (fi->fi_checksum == 0) fi->fi_checksum = checksum; else if (checksum && fi->fi_checksum != checksum) { diff --git a/Build/source/texk/seetexk/search.c b/Build/source/texk/seetexk/search.c index c5b9ae6f245..c604b78b018 100644 --- a/Build/source/texk/seetexk/search.c +++ b/Build/source/texk/seetexk/search.c @@ -139,7 +139,7 @@ SSearch(struct search *s, i32 key, int *disp) return (0); } keyaddr = (keyaddr - s->s_data) + new; /* relocate */ - bcopy(s->s_data, new, s->s_n * s->s_dsize); + memcpy(new, s->s_data, s->s_n * s->s_dsize); free(s->s_data); s->s_data = new; s->s_space = s->s_n; @@ -164,8 +164,8 @@ SSearch(struct search *s, i32 key, int *disp) s->s_space--; *(i32 *) keyaddr = key; keyaddr += DOffset; /* now actually dataaddr */ - /* the bzero is just a frill... */ - bzero(keyaddr, s->s_dsize - DOffset); + /* the memset is just a frill... */ + memset(keyaddr, 0, s->s_dsize - DOffset); return (keyaddr); } diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog index 74b214fad16..d9988d63f3b 100644 --- a/Build/source/texk/web2c/luatexdir/ChangeLog +++ b/Build/source/texk/web2c/luatexdir/ChangeLog @@ -1,3 +1,7 @@ +2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + * lua/lcallbacklib.c, lua/luainit.w: Replace index() => strchr(). + 2013-06-28 Karl Berry <karl@tug.org> * ptexlib.h: complain if various common things are #defined; diff --git a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c index c2e31c6a860..7a430350ee7 100644 --- a/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c +++ b/Build/source/texk/web2c/luatexdir/lua/lcallbacklib.c @@ -271,7 +271,7 @@ int do_run_callback(int special, const char *values, va_list vl) luaL_checkstack(L, 1, "out of stack space"); lua_pushvalue(L, -2); } - ss = index(values, '>'); + ss = strchr(values, '>'); assert(ss); luaL_checkstack(L, (int) (ss - values + 1), "out of stack space"); ss = NULL; diff --git a/Build/source/texk/web2c/luatexdir/lua/luainit.w b/Build/source/texk/web2c/luatexdir/lua/luainit.w index c838a836f88..90b970c648c 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luainit.w +++ b/Build/source/texk/web2c/luatexdir/lua/luainit.w @@ -483,7 +483,7 @@ static char *cleaned_invocation_name(char *arg) char *ret, *dot; const char *start = xbasename(arg); ret = xstrdup(start); - dot = index(ret, '.'); + dot = strchr(ret, '.'); if (dot != NULL) { *dot = 0; /* chop */ } diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index 02c036923bd..3e7d32dcf31 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,7 @@ +2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + * pngout.w: Replace index() => strchr(). + 2013-06-19 Peter Breitenlohner <peb@mppmu.mpg.de> * lmplib.c: Replace '<../lua52/lua.h>' => '<lua.h>'. diff --git a/Build/source/texk/web2c/mplibdir/pngout.w b/Build/source/texk/web2c/mplibdir/pngout.w index 5b9b6f34d4c..c4ce4d82567 100644 --- a/Build/source/texk/web2c/mplibdir/pngout.w +++ b/Build/source/texk/web2c/mplibdir/pngout.w @@ -791,7 +791,7 @@ int mp_png_gr_ship_out (mp_edge_object *hh, const char *options, int standalone) currentoption += 4; } } - currentoption = index(currentoption,' '); + currentoption = strchr(currentoption,' '); if (currentoption) { while (*currentoption == ' ') currentoption++; diff --git a/Build/source/texk/web2c/omegafonts/ChangeLog b/Build/source/texk/web2c/omegafonts/ChangeLog index a29ceabf05a..7bcd9e1635d 100644 --- a/Build/source/texk/web2c/omegafonts/ChangeLog +++ b/Build/source/texk/web2c/omegafonts/ChangeLog @@ -1,3 +1,7 @@ +2013-06-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + * pl-lexer.l: Add '#include <kpathsea/c-memstr.h>' for strlen(). + 2013-01-29 Peter Breitenlohner <peb@mppmu.mpg.de> * Makefile.am: Allow subdir-objects. diff --git a/Build/source/texk/web2c/omegafonts/pl-lexer.c b/Build/source/texk/web2c/omegafonts/pl-lexer.c index f779d3614ff..f2d39860d47 100644 --- a/Build/source/texk/web2c/omegafonts/pl-lexer.c +++ b/Build/source/texk/web2c/omegafonts/pl-lexer.c @@ -1010,10 +1010,10 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Omega; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ #include <kpathsea/lib.h> +#include <kpathsea/c-memstr.h> #include "parser.h" #include "pl-parser.h" #include "manifests.h" diff --git a/Build/source/texk/web2c/omegafonts/pl-lexer.l b/Build/source/texk/web2c/omegafonts/pl-lexer.l index ef255d0e1d1..394e490097b 100644 --- a/Build/source/texk/web2c/omegafonts/pl-lexer.l +++ b/Build/source/texk/web2c/omegafonts/pl-lexer.l @@ -22,10 +22,10 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Omega; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ #include <kpathsea/lib.h> +#include <kpathsea/c-memstr.h> #include "parser.h" #include "pl-parser.h" #include "manifests.h" |