2011-03-19 Paul Eggert <eggert@cs.ucla.edu>
+ Make tparam.h and terminfo.c consistent.
+ * cm.c (tputs, tgoto, BC, UP): Remove extern decls. Include
+ tparam.h instead, since it declares them.
+ * cm.h (PC): Remove extern decl; tparam.h now does this.
+ * deps.mk (cm.o, terminfo.o): Depend on tparam.h.
+ * terminfo.c: Include tparam.h, to check interfaces.
+ (tparm): Make 1st arg a const pointer in decl. Put it at top level.
+ (tparam): Adjust signature to match interface in tparam.h;
+ this removes some undefined behavior. Check that outstring and len
+ are zero, which they always are with Emacs.
+ * tparam.h (PC, BC, UP): New extern decls.
+
* xftfont.c (xftfont_shape): Now static, and defined only if needed.
(xftfont_open): Rename locals to avoid shadowing.
#include "cm.h"
#include "termhooks.h"
#include "termchar.h"
-
-
-/* For now, don't try to include termcap.h. On some systems,
- configure finds a non-standard termcap.h that the main build
- won't find. */
-extern void tputs (const char *, int, int (*)(int));
-extern char *tgoto (const char *, int, int);
+#include "tparam.h"
#define BIG 9999 /* 9999 good on VAXen. For 16 bit machines
use about 2000.... */
-extern char *BC, *UP;
-
int cost; /* sums up costs */
/* ARGSUSED */
int cc_vabs;
};
-extern char PC; /* Pad character */
-
/* Shorthand */
#ifndef NoCMShortHand
#define curY(tty) (tty)->Wcm->cm_curY
window.h dispextern.h msdos.h frame.h termhooks.h \
lisp.h globals.h $(config_h)
cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \
- lisp.h globals.h $(config_h)
+ tparam.h lisp.h globals.h $(config_h)
cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \
globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \
coding.h frame.h composite.h
terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \
msdos.h
-terminfo.o: terminfo.c lisp.h globals.h $(config_h)
+terminfo.o: terminfo.c tparam.h lisp.h globals.h $(config_h)
tparam.o: tparam.c tparam.h lisp.h $(config_h)
undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \
lisp.h globals.h $(config_h)
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
+#include "tparam.h"
+
#include <setjmp.h>
#include "lisp.h"
format is different too.
*/
+extern char *tparm (const char *str, ...);
+
+
char *
-tparam (char *string, char *outstring,
- int len, int arg1, int arg2, int arg3, int arg4,
- int arg5, int arg6, int arg7, int arg8, int arg9)
+tparam (const char *string, char *outstring, int len,
+ int arg1, int arg2, int arg3, int arg4)
{
char *temp;
- extern char *tparm (char *str, ...);
- temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
- if (outstring == 0)
- outstring = ((char *) (xmalloc ((strlen (temp)) + 1)));
- strcpy (outstring, temp);
- return outstring;
-}
+ /* Emacs always should pass a null OUTSTRING and zero LEN. */
+ if (outstring || len)
+ abort ();
+ temp = tparm (string, arg1, arg2, arg3, arg4);
+ return xstrdup (temp);
+}
char *tgoto (const char *, int, int);
char *tparam (const char *, char *, int, int, int, int, int);
+
+extern char PC;
+extern char *BC;
+extern char *UP;