Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libterminfo Remove _ti_freeterm as consumers should just...
details: https://anonhg.NetBSD.org/src/rev/8b44b3c03040
branches: trunk
changeset: 770104:8b44b3c03040
user: roy <roy%NetBSD.org@localhost>
date: Mon Oct 03 19:18:55 2011 +0000
description:
Remove _ti_freeterm as consumers should just use del_curterm.
diffstat:
lib/libterminfo/curterm.c | 16 +++++++++++-----
lib/libterminfo/setupterm.c | 8 ++++----
lib/libterminfo/term.c | 31 +++++++------------------------
lib/libterminfo/term_private.h | 3 +--
4 files changed, 23 insertions(+), 35 deletions(-)
diffs (160 lines):
diff -r d8138f6e7c21 -r 8b44b3c03040 lib/libterminfo/curterm.c
--- a/lib/libterminfo/curterm.c Mon Oct 03 19:15:03 2011 +0000
+++ b/lib/libterminfo/curterm.c Mon Oct 03 19:18:55 2011 +0000
@@ -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 @@
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 *
diff -r d8138f6e7c21 -r 8b44b3c03040 lib/libterminfo/setupterm.c
--- a/lib/libterminfo/setupterm.c Mon Oct 03 19:15:03 2011 +0000
+++ b/lib/libterminfo/setupterm.c Mon Oct 03 19:18:55 2011 +0000
@@ -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 @@
error = _ti_getterm(*nterm, term, 0);
if (error != 1) {
- free(*nterm);
+ del_curterm(*nterm);
*nterm = NULL;
switch (error) {
case -1:
diff -r d8138f6e7c21 -r 8b44b3c03040 lib/libterminfo/term.c
--- a/lib/libterminfo/term.c Mon Oct 03 19:15:03 2011 +0000
+++ b/lib/libterminfo/term.c Mon Oct 03 19:18:55 2011 +0000
@@ -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 @@
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 @@
break;
default:
errno = EINVAL;
- goto err;
+ return -1;
}
}
}
return 1;
-
-err:
- _ti_freeterm(term);
- return -1;
}
static int
@@ -404,16 +400,3 @@
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);
- }
-}
diff -r d8138f6e7c21 -r 8b44b3c03040 lib/libterminfo/term_private.h
--- a/lib/libterminfo/term_private.h Mon Oct 03 19:15:03 2011 +0000
+++ b/lib/libterminfo/term_private.h Mon Oct 03 19:18:55 2011 +0000
@@ -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_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)
Home |
Main Index |
Thread Index |
Old Index