aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-03-19 15:46:50 -0700
committerPaul Eggert2011-03-19 15:46:50 -0700
commitaf8a867c625d0ba45177795dea995a842b22e5f6 (patch)
tree618a22c5d2bc5e18fafccb5328f08b328fea0f21 /src
parent001a7ab41b79b45c0c6a1b5b90fe4ed9bbfe4e14 (diff)
downloademacs-af8a867c625d0ba45177795dea995a842b22e5f6.tar.gz
emacs-af8a867c625d0ba45177795dea995a842b22e5f6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/cm.c10
-rw-r--r--src/cm.h2
-rw-r--r--src/deps.mk4
-rw-r--r--src/terminfo.c23
-rw-r--r--src/tparam.h4
6 files changed, 32 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 37534dc6c64..841f4ee69dc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,17 @@
12011-03-19 Paul Eggert <eggert@cs.ucla.edu> 12011-03-19 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Make tparam.h and terminfo.c consistent.
4 * cm.c (tputs, tgoto, BC, UP): Remove extern decls. Include
5 tparam.h instead, since it declares them.
6 * cm.h (PC): Remove extern decl; tparam.h now does this.
7 * deps.mk (cm.o, terminfo.o): Depend on tparam.h.
8 * terminfo.c: Include tparam.h, to check interfaces.
9 (tparm): Make 1st arg a const pointer in decl. Put it at top level.
10 (tparam): Adjust signature to match interface in tparam.h;
11 this removes some undefined behavior. Check that outstring and len
12 are zero, which they always are with Emacs.
13 * tparam.h (PC, BC, UP): New extern decls.
14
3 * xftfont.c (xftfont_shape): Now static, and defined only if needed. 15 * xftfont.c (xftfont_shape): Now static, and defined only if needed.
4 (xftfont_open): Rename locals to avoid shadowing. 16 (xftfont_open): Rename locals to avoid shadowing.
5 17
diff --git a/src/cm.c b/src/cm.c
index 108ee5720f3..6379955b48c 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -27,19 +27,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include "cm.h" 27#include "cm.h"
28#include "termhooks.h" 28#include "termhooks.h"
29#include "termchar.h" 29#include "termchar.h"
30 30#include "tparam.h"
31
32/* For now, don't try to include termcap.h. On some systems,
33 configure finds a non-standard termcap.h that the main build
34 won't find. */
35extern void tputs (const char *, int, int (*)(int));
36extern char *tgoto (const char *, int, int);
37 31
38#define BIG 9999 /* 9999 good on VAXen. For 16 bit machines 32#define BIG 9999 /* 9999 good on VAXen. For 16 bit machines
39 use about 2000.... */ 33 use about 2000.... */
40 34
41extern char *BC, *UP;
42
43int cost; /* sums up costs */ 35int cost; /* sums up costs */
44 36
45/* ARGSUSED */ 37/* ARGSUSED */
diff --git a/src/cm.h b/src/cm.h
index 5d430598f0c..8f23990ce55 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -96,8 +96,6 @@ struct cm
96 int cc_vabs; 96 int cc_vabs;
97 }; 97 };
98 98
99extern char PC; /* Pad character */
100
101/* Shorthand */ 99/* Shorthand */
102#ifndef NoCMShortHand 100#ifndef NoCMShortHand
103#define curY(tty) (tty)->Wcm->cm_curY 101#define curY(tty) (tty)->Wcm->cm_curY
diff --git a/src/deps.mk b/src/deps.mk
index 35754dfa7de..d84e80dca44 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -65,7 +65,7 @@ coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h composite.h \
65 window.h dispextern.h msdos.h frame.h termhooks.h \ 65 window.h dispextern.h msdos.h frame.h termhooks.h \
66 lisp.h globals.h $(config_h) 66 lisp.h globals.h $(config_h)
67cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \ 67cm.o: cm.c frame.h cm.h termhooks.h termchar.h dispextern.h msdos.h \
68 lisp.h globals.h $(config_h) 68 tparam.h lisp.h globals.h $(config_h)
69cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \ 69cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h lisp.h \
70 globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \ 70 globals.h $(config_h) msdos.h dispextern.h keyboard.h keymap.h systime.h \
71 coding.h frame.h composite.h 71 coding.h frame.h composite.h
@@ -196,7 +196,7 @@ termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h)
196terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ 196terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
197 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ 197 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \
198 msdos.h 198 msdos.h
199terminfo.o: terminfo.c lisp.h globals.h $(config_h) 199terminfo.o: terminfo.c tparam.h lisp.h globals.h $(config_h)
200tparam.o: tparam.c tparam.h lisp.h $(config_h) 200tparam.o: tparam.c tparam.h lisp.h $(config_h)
201undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ 201undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \
202 lisp.h globals.h $(config_h) 202 lisp.h globals.h $(config_h)
diff --git a/src/terminfo.c b/src/terminfo.c
index 905a8edacc7..c0418984efa 100644
--- a/src/terminfo.c
+++ b/src/terminfo.c
@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include <config.h> 19#include <config.h>
20#include "tparam.h"
21
20#include <setjmp.h> 22#include <setjmp.h>
21#include "lisp.h" 23#include "lisp.h"
22 24
@@ -33,18 +35,19 @@ char *UP, *BC, PC;
33 format is different too. 35 format is different too.
34*/ 36*/
35 37
38extern char *tparm (const char *str, ...);
39
40
36char * 41char *
37tparam (char *string, char *outstring, 42tparam (const char *string, char *outstring, int len,
38 int len, int arg1, int arg2, int arg3, int arg4, 43 int arg1, int arg2, int arg3, int arg4)
39 int arg5, int arg6, int arg7, int arg8, int arg9)
40{ 44{
41 char *temp; 45 char *temp;
42 extern char *tparm (char *str, ...);
43 46
44 temp = tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); 47 /* Emacs always should pass a null OUTSTRING and zero LEN. */
45 if (outstring == 0) 48 if (outstring || len)
46 outstring = ((char *) (xmalloc ((strlen (temp)) + 1))); 49 abort ();
47 strcpy (outstring, temp);
48 return outstring;
49}
50 50
51 temp = tparm (string, arg1, arg2, arg3, arg4);
52 return xstrdup (temp);
53}
diff --git a/src/tparam.h b/src/tparam.h
index 3cd3e6053cc..dc4cdfaa28c 100644
--- a/src/tparam.h
+++ b/src/tparam.h
@@ -29,3 +29,7 @@ char *tgetstr (const char *, char **);
29char *tgoto (const char *, int, int); 29char *tgoto (const char *, int, int);
30 30
31char *tparam (const char *, char *, int, int, int, int, int); 31char *tparam (const char *, char *, int, int, int, int, int);
32
33extern char PC;
34extern char *BC;
35extern char *UP;