From be7181525a93d0b7499364115803130a18c1939d Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 1 Jul 2013 13:44:15 +0000 Subject: Eliminate use of BSD string functions (bcopy etc) git-svn-id: svn://tug.org/texlive/trunk@31058 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 4 ++++ Build/source/texk/kpathsea/c-memstr.h | 28 +++------------------------- Build/source/texk/seetexk/ChangeLog | 5 +++++ Build/source/texk/seetexk/dviselect.c | 6 ------ Build/source/texk/seetexk/types.h | 18 +----------------- Build/source/texk/web2c/window/ChangeLog | 5 +++++ Build/source/texk/web2c/window/tek.c | 6 +++--- Build/source/texk/xdvik/ChangeLog | 6 ++++++ Build/source/texk/xdvik/font-open.c | 8 ++++---- Build/source/texk/xdvik/psdps.c | 12 ++++++------ Build/source/texk/xdvik/psgs.c | 2 +- Build/source/texk/xdvik/xdvi.h | 7 ------- 12 files changed, 38 insertions(+), 69 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 1810652e8d8..e4081b044b2 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,7 @@ +2013-07-01 Peter Breitenlohner + + * c-memstr.h: Drop mapping of BSD => SYSV/ANSI string functions. + 2013-06-25 Karl Berry * texmf.cnf (guess_input_kanji_encoding): config variable, diff --git a/Build/source/texk/kpathsea/c-memstr.h b/Build/source/texk/kpathsea/c-memstr.h index 8d074a90822..e8e107a6f98 100644 --- a/Build/source/texk/kpathsea/c-memstr.h +++ b/Build/source/texk/kpathsea/c-memstr.h @@ -1,7 +1,6 @@ /* c-memstr.h: memcpy, strchr, etc. - Copyright 1992, 1993, 1994, 1995, 1997 1998, 1999, 2000, 2004, 2005, - 2006, 2008 Karl Berry and Olaf Weber. + Copyright 1992-2013 Karl Berry and Olaf Weber. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -36,8 +35,8 @@ #include #endif /* not STDC_HEADERS and HAVE_MEMORY_H */ -/* Just to be complete, we make both the system V/ANSI and the BSD - versions of the string functions available. */ +/* For ancient systems that lack the system V/ANSI version of the + string functions we express them in terms of the BSD versions. */ #if !defined(HAVE_STRCHR) && !defined(strchr) #define strchr index #endif @@ -54,27 +53,6 @@ #define memcpy(to, from, len) bcopy ((from), (to), (len)) #endif -/* Note that these functions should not be used. */ -#if !defined(HAVE_BCMP) && !defined(bcmp) -#define bcmp(s1, s2, len) memcmp ((s1), (s2), (len)) -#endif - -#if !defined(HAVE_BCOPY) && !defined(bcopy) -#define bcopy(from, to, len) memcpy ((to), (from), (len)) -#endif - -#if !defined(HAVE_BZERO) && !defined(bzero) -#define bzero(s, len) memset ((s), 0, (len)) -#endif - -#if !defined(HAVE_INDEX) && !defined(index) -#define index(s, c) strchr ((s), (c)) -#endif - -#if !defined(HAVE_RINDEX) && !defined(rindex) -#define rindex(s, c) strrchr ((s), (c)) -#endif - #if !defined(HAVE_STRING_H) extern char *strtok (); #ifndef strstr diff --git a/Build/source/texk/seetexk/ChangeLog b/Build/source/texk/seetexk/ChangeLog index 394c88a4819..97dde57b734 100644 --- a/Build/source/texk/seetexk/ChangeLog +++ b/Build/source/texk/seetexk/ChangeLog @@ -1,3 +1,8 @@ +2013-07-01 Peter Breitenlohner + + * dviselect.c, types.h: Replace bcopy(f, t, l) => + memcpy(t, f, l). + 2013-06-28 Peter Breitenlohner * dviconcat.c: Replace bcmp() => memcmp(). diff --git a/Build/source/texk/seetexk/dviselect.c b/Build/source/texk/seetexk/dviselect.c index 175ec6efbc0..a8a2dc33f4b 100644 --- a/Build/source/texk/seetexk/dviselect.c +++ b/Build/source/texk/seetexk/dviselect.c @@ -163,12 +163,6 @@ static int ParsePages(char *); static void HandleDVIFile(void); static void PutFontSelector(i32); -#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(); #endif /* not KPATHSEA */ diff --git a/Build/source/texk/seetexk/types.h b/Build/source/texk/seetexk/types.h index e263acf36b9..2bb631769d8 100644 --- a/Build/source/texk/seetexk/types.h +++ b/Build/source/texk/seetexk/types.h @@ -59,7 +59,7 @@ * (The bcopy provided in lib/bcopy.c does handle overlap.) */ /* #define BLOCK_COPY(from, to, len) memmove(to, from, len) */ -#define BLOCK_COPY(from, to, len) bcopy(from, to, len) +#define BLOCK_COPY(from, to, len) memmove(to, from, len) /* * Define void as int if your compiler does not support void, @@ -75,22 +75,6 @@ */ #define HAVE_VPRINTF -/* - * If you have memcpy/memmove, but not bcopy, use the definition below. - * If you have neither, try the bcopy provided in lib/bcopy.c. - */ -#define bcopy(from, to, len) memmove(to, from, len) - -/* - * If you have memcmp, but not bcmp, use the definition below. - * If you have neither, try the bcmp provided in lib/bcmp.c. - */ -#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 /* KPATHSEA */ /* diff --git a/Build/source/texk/web2c/window/ChangeLog b/Build/source/texk/web2c/window/ChangeLog index d1e41767ca3..24a0e26ab2b 100644 --- a/Build/source/texk/web2c/window/ChangeLog +++ b/Build/source/texk/web2c/window/ChangeLog @@ -1,3 +1,8 @@ +2013-07-01 Peter Breitenlohner + + * tek.c: Replace bzero(t, l) => memset(t, 0, l) and bcmp() => + memcmp(). + 2012-11-20 Peter Breitenlohner * Makefile.am: Avoid use of deprecated INCLUDES. diff --git a/Build/source/texk/web2c/window/tek.c b/Build/source/texk/web2c/window/tek.c index 077184e7253..86b5108784c 100644 --- a/Build/source/texk/web2c/window/tek.c +++ b/Build/source/texk/web2c/window/tek.c @@ -38,7 +38,7 @@ char zero_array[WIDTHINBYTES]; int mf_tektronix_initscreen(void) { - bzero(zero_array, sizeof(zero_array)); + memset(zero_array, 0, sizeof(zero_array)); return 1; } @@ -55,7 +55,7 @@ mf_tektronix_updatescreen(void) printf("%c%c", ESCAPE, FORMFEED); for (r = 0; r < HEIGHT; r++) { makingline = FALSE; - if (bcmp(&screen_pixel[r*WIDTHINBYTES],zero_array,WIDTHINBYTES) == 0) + if (memcmp(&screen_pixel[r*WIDTHINBYTES],zero_array,WIDTHINBYTES) == 0) continue; for (c = 0; c < WIDTH; c++) { if (ISSET(r, c)) { @@ -105,7 +105,7 @@ mf_tektronix_blankrectangle (screencol left, int r, c; if (left == 0 && right == WIDTH && top == 0 && bottom == HEIGHT) - bzero(screen_pixel, sizeof(screen_pixel)); + memset(screen_pixel, 0, sizeof(screen_pixel)); else for (r = top; r < bottom; r++) for (c = left; c < right; c++) diff --git a/Build/source/texk/xdvik/ChangeLog b/Build/source/texk/xdvik/ChangeLog index 33849b80a20..e652c0b35ce 100644 --- a/Build/source/texk/xdvik/ChangeLog +++ b/Build/source/texk/xdvik/ChangeLog @@ -1,3 +1,9 @@ +2013-07-01 Peter Breitenlohner + + * font-open.c, psdps.c, xdvi.h: Replace bcopy(f, t, l) => + memcpy(t, f, l). + * psgs.c: Replace rindex() => strrchr(). + 2013-06-28 Peter Breitenlohner * xlwradioP.h: May need to #include . diff --git a/Build/source/texk/xdvik/font-open.c b/Build/source/texk/xdvik/font-open.c index d0a3cef062f..61ef08d9c12 100644 --- a/Build/source/texk/xdvik/font-open.c +++ b/Build/source/texk/xdvik/font-open.c @@ -971,7 +971,7 @@ get_gs_token(struct gsfile *gsfp, unsigned int len = gsfp->bufpos - p0; if (pos + len >= ffline_len) expandline(pos + len); - bcopy(p0, ffline + pos, len); + memmove(ffline + pos, p0, len); pos += len; if (!gs_fillbuf(gsfp)) break; @@ -981,7 +981,7 @@ get_gs_token(struct gsfile *gsfp, unsigned int len = gsfp->bufpos - p0; if (pos + len >= ffline_len) expandline(pos + len); - bcopy(p0, ffline + pos, len); + memmove(ffline + pos, p0, len); pos += len; break; } @@ -1001,7 +1001,7 @@ get_gs_token(struct gsfile *gsfp, unsigned int len = gsfp->bufpos - p0; if (pos + len >= ffline_len) expandline(pos + len); - bcopy(p0, ffline + pos, len); + memmove(ffline + pos, p0, len); pos += len; if (!gs_fillbuf(gsfp)) { TRACE_FT((stderr, @@ -1041,7 +1041,7 @@ get_gs_token(struct gsfile *gsfp, if (pos + len >= ffline_len) expandline(pos + len); - bcopy(p0, ffline + pos, len); + memmove(ffline + pos, p0, len); pos += len; gsfp->bufpos = p1 + 1; break; diff --git a/Build/source/texk/xdvik/psdps.c b/Build/source/texk/xdvik/psdps.c index e77c88091bc..466eb59bce0 100644 --- a/Build/source/texk/xdvik/psdps.c +++ b/Build/source/texk/xdvik/psdps.c @@ -189,7 +189,7 @@ TextProc(DPSContext ctxt, char *buf, unsigned long count) i = line + BUFLEN - linepos; if (i > count) i = count; - (void)bcopy(buf, linepos, i); + memmove(linepos, buf, i); linepos += i; buf += i; count -= i; @@ -202,7 +202,7 @@ TextProc(DPSContext ctxt, char *buf, unsigned long count) p = memchr(p0, '\n', linepos - p0); if (p == NULL) { if (p0 != line) { - (void)bcopy(p0, line, linepos - p0); + memmove(line, p0, linepos - p0); linepos -= p0 - line; } else if (linepos == line + BUFLEN) { @@ -213,7 +213,7 @@ TextProc(DPSContext ctxt, char *buf, unsigned long count) printf("DPS: %s\n", line); line[LINELEN] = c; linepos -= LINELEN; - (void)bcopy(line + LINELEN, line, linepos - line); + memmove(line, line + LINELEN, linepos - line); } break; } @@ -224,7 +224,7 @@ TextProc(DPSContext ctxt, char *buf, unsigned long count) if (globals.debug & DBG_PS) printf("Got DPS ack; %d pending.\n", DPS_pending); ++p; - (void)bcopy(p, p - 9, linepos - p); + memmove(p, p - 9, p, linepos - p); linepos -= 9; continue; } @@ -233,7 +233,7 @@ TextProc(DPSContext ctxt, char *buf, unsigned long count) if (globals.debug & DBG_PS) puts("Got DPS int."); ++p; - (void)bcopy(p, p - 9, linepos - p); + memmove(p - 9, p, linepos - p); linepos -= 9; globals.ev.flags |= EV_ACK; continue; @@ -242,7 +242,7 @@ TextProc(DPSContext ctxt, char *buf, unsigned long count) if (globals.debug & DBG_PS) puts("Got DPS int 2."); ++p; - (void)bcopy(p, p - 9, linepos - p); + memmove(p - 9, p, linepos - p); linepos -= 9; DPS_pending = 3; diff --git a/Build/source/texk/xdvik/psgs.c b/Build/source/texk/xdvik/psgs.c index 3881c0c2b07..a5d22776e2d 100644 --- a/Build/source/texk/xdvik/psgs.c +++ b/Build/source/texk/xdvik/psgs.c @@ -268,7 +268,7 @@ read_from_gs(int fd, void *data) --p; } *line_end = '\0'; - p = rindex(linepos, '\n'); + p = strrchr(linepos, '\n'); if (p != NULL) { ++p; showto(p); diff --git a/Build/source/texk/xdvik/xdvi.h b/Build/source/texk/xdvik/xdvi.h index 2851f7e7d87..3112655a1e1 100644 --- a/Build/source/texk/xdvik/xdvi.h +++ b/Build/source/texk/xdvik/xdvi.h @@ -201,13 +201,6 @@ extern unsigned long time_start, time_end; #include -#ifdef VMS -# define index strchr -# define rindex strrchr -# define bzero(a, b) (void) memset ((void *) (a), 0, (size_t) (b)) -# define bcopy(a, b, c) (void) memmove ((void *) (b), (void *) (a), (size_t) (c)) -#endif - #include #include -- cgit v1.2.3