Remove _ti_freeterm as consumers should just use del_curterm.
This commit is contained in:
parent
7fc83a7d87
commit
91ab69b0df
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: curterm.c,v 1.5 2011/10/02 19:24:25 roy Exp $ */
|
||||
/* $NetBSD: curterm.c,v 1.6 2011/10/03 19:18:55 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: curterm.c,v 1.5 2011/10/02 19:24:25 roy Exp $");
|
||||
__RCSID("$NetBSD: curterm.c,v 1.6 2011/10/03 19:18:55 roy Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -90,9 +90,15 @@ int
|
|||
del_curterm(TERMINAL *oterm)
|
||||
{
|
||||
|
||||
_DIAGASSERT(oterm != NULL);
|
||||
_ti_freeterm(oterm);
|
||||
return 0;
|
||||
if (oterm == NULL)
|
||||
return ERR;
|
||||
free(oterm->_area);
|
||||
free(oterm->strs);
|
||||
free(oterm->nums);
|
||||
free(oterm->flags);
|
||||
free(oterm->_userdefs);
|
||||
free(oterm);
|
||||
return OK;
|
||||
}
|
||||
|
||||
char *
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: setupterm.c,v 1.2 2010/02/11 00:27:09 roy Exp $ */
|
||||
/* $NetBSD: setupterm.c,v 1.3 2011/10/03 19:18:55 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Roy Marples.
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: setupterm.c,v 1.2 2010/02/11 00:27:09 roy Exp $");
|
||||
__RCSID("$NetBSD: setupterm.c,v 1.3 2011/10/03 19:18:55 roy Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
|
@ -82,7 +82,7 @@ ti_setupterm(TERMINAL **nterm, const char *term, int fildes, int *errret)
|
|||
|
||||
error = _ti_getterm(*nterm, term, 0);
|
||||
if (error != 1) {
|
||||
free(*nterm);
|
||||
del_curterm(*nterm);
|
||||
*nterm = NULL;
|
||||
switch (error) {
|
||||
case -1:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: term.c,v 1.12 2011/04/11 21:37:19 roy Exp $ */
|
||||
/* $NetBSD: term.c,v 1.13 2011/10/03 19:18:55 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: term.c,v 1.12 2011/04/11 21:37:19 roy Exp $");
|
||||
__RCSID("$NetBSD: term.c,v 1.13 2011/10/03 19:18:55 roy Exp $");
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
@ -70,18 +70,18 @@ _ti_readterm(TERMINAL *term, const char *cap, size_t caplen, int flags)
|
|||
|
||||
term->flags = calloc(TIFLAGMAX + 1, sizeof(char));
|
||||
if (term->flags == NULL)
|
||||
goto err;
|
||||
return -1;
|
||||
term->nums = malloc((TINUMMAX + 1) * sizeof(short));
|
||||
if (term->nums == NULL)
|
||||
goto err;
|
||||
return -1;
|
||||
memset(term->nums, (short)-1, (TINUMMAX + 1) * sizeof(short));
|
||||
term->strs = calloc(TISTRMAX + 1, sizeof(char *));
|
||||
if (term->strs == NULL)
|
||||
goto err;
|
||||
return -1;
|
||||
term->_arealen = caplen;
|
||||
term->_area = malloc(term->_arealen);
|
||||
if (term->_area == NULL)
|
||||
goto err;
|
||||
return -1;
|
||||
memcpy(term->_area, cap, term->_arealen);
|
||||
|
||||
cap = term->_area;
|
||||
|
@ -205,15 +205,11 @@ _ti_readterm(TERMINAL *term, const char *cap, size_t caplen, int flags)
|
|||
break;
|
||||
default:
|
||||
errno = EINVAL;
|
||||
goto err;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
||||
err:
|
||||
_ti_freeterm(term);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -404,16 +400,3 @@ _ti_getterm(TERMINAL *term, const char *name, int flags)
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
_ti_freeterm(TERMINAL *term)
|
||||
{
|
||||
|
||||
if (term != NULL) {
|
||||
free(term->_area);
|
||||
free(term->strs);
|
||||
free(term->nums);
|
||||
free(term->flags);
|
||||
free(term->_userdefs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: term_private.h,v 1.8 2010/09/22 06:10:51 roy Exp $ */
|
||||
/* $NetBSD: term_private.h,v 1.9 2011/10/03 19:18:55 roy Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
|
||||
|
@ -114,7 +114,6 @@ const char * _ti_numid(ssize_t);
|
|||
const char * _ti_strid(ssize_t);
|
||||
int _ti_getterm(TERMINAL *, const char *, int);
|
||||
void _ti_setospeed(TERMINAL *);
|
||||
void _ti_freeterm(TERMINAL *);
|
||||
|
||||
/* libterminfo can compile terminfo strings too */
|
||||
#define TIC_WARNING (1 << 0)
|
||||
|
|
Loading…
Reference in New Issue