X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/93afd0f1d463bec0fc8d3127c1d34ccaa4dbe99b..84c9ce0579c1f16670d15c486dc3ceeb3c103af1:/src/tparam.c diff --git a/src/tparam.c b/src/tparam.c index dea57ff746..d8a8f0260f 100644 --- a/src/tparam.c +++ b/src/tparam.c @@ -1,6 +1,6 @@ /* Merge parameters into a termcap entry string. Copyright (C) 1985, 1987, 1993, 1995, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 Free Software Foundation, Inc. + 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,65 +18,14 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Emacs config.h may rename various library functions such as malloc. */ -#ifdef HAVE_CONFIG_H #include -#endif - -#ifdef emacs +#include #include "lisp.h" /* for xmalloc */ -#else - -#ifdef STDC_HEADERS -#include -#include -#else -char *malloc (); -char *realloc (); -#endif - -/* Do this after the include, in case string.h prototypes bcopy. */ -#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#endif - -#endif /* not emacs */ #ifndef NULL #define NULL (char *) 0 #endif -#ifndef emacs -static void -memory_out () -{ - write (2, "virtual memory exhausted\n", 25); - exit (1); -} - -static char * -xmalloc (size) - unsigned size; -{ - register char *tem = malloc (size); - - if (!tem) - memory_out (); - return tem; -} - -static char * -xrealloc (ptr, size) - char *ptr; - unsigned size; -{ - register char *tem = realloc (ptr, size); - - if (!tem) - memory_out (); - return tem; -} -#endif /* not emacs */ - /* Assuming STRING is the value of a termcap string entry containing `%' constructs to expand parameters, merge in parameter values and store result in block OUTSTRING points to. @@ -89,15 +38,11 @@ xrealloc (ptr, size) The fourth and following args to tparam serve as the parameter values. */ -static char *tparam1 (); +static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp); /* VARARGS 2 */ char * -tparam (string, outstring, len, arg0, arg1, arg2, arg3) - char *string; - char *outstring; - int len; - int arg0, arg1, arg2, arg3; +tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3) { int arg[4]; @@ -108,18 +53,13 @@ tparam (string, outstring, len, arg0, arg1, arg2, arg3) return tparam1 (string, outstring, len, NULL, NULL, arg); } -/* These are already defined in the System framework in Mac OS X and - cause prebinding to fail. */ -#ifndef MAC_OSX char *BC; char *UP; static char tgoto_buf[50]; char * -tgoto (cm, hpos, vpos) - char *cm; - int hpos, vpos; +tgoto (char *cm, int hpos, int vpos) { int args[2]; if (!cm) @@ -128,15 +68,9 @@ tgoto (cm, hpos, vpos) args[1] = hpos; return tparam1 (cm, tgoto_buf, 50, UP, BC, args); } -#endif static char * -tparam1 (string, outstring, len, up, left, argp) - char *string; - char *outstring; - int len; - char *up, *left; - register int *argp; +tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp) { register int c; register char *p = string; @@ -165,7 +99,7 @@ tparam1 (string, outstring, len, up, left, argp) { outlen = len + 40; new = (char *) xmalloc (outlen); - bcopy (outstring, new, offset); + memcpy (new, outstring, offset); } else {