summaryrefslogtreecommitdiff
path: root/src/terminfo.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-03-19 15:46:50 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-03-19 15:46:50 -0700
commitaf8a867c625d0ba45177795dea995a842b22e5f6 (patch)
tree618a22c5d2bc5e18fafccb5328f08b328fea0f21 /src/terminfo.c
parent001a7ab41b79b45c0c6a1b5b90fe4ed9bbfe4e14 (diff)
downloademacs-af8a867c625d0ba45177795dea995a842b22e5f6.tar.gz
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/terminfo.c')
-rw-r--r--src/terminfo.c23
1 files changed, 13 insertions, 10 deletions
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
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
+#include "tparam.h"
+
#include <setjmp.h>
#include "lisp.h"
@@ -33,18 +35,19 @@ char *UP, *BC, PC;
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);
+}