Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libterm sprinkle some _DIAGASSERT()s in



details:   https://anonhg.NetBSD.org/src/rev/1a7931263dd0
branches:  trunk
changeset: 501919:1a7931263dd0
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jan 09 07:18:49 2001 +0000

description:
sprinkle some _DIAGASSERT()s in

diffstat:

 lib/libterm/termcap.c |   7 +++++--
 lib/libterm/tgoto.c   |   6 ++++--
 lib/libterm/tputs.c   |  15 +++++++++++----
 3 files changed, 20 insertions(+), 8 deletions(-)

diffs (101 lines):

diff -r 2b652711defe -r 1a7931263dd0 lib/libterm/termcap.c
--- a/lib/libterm/termcap.c     Tue Jan 09 06:36:13 2001 +0000
+++ b/lib/libterm/termcap.c     Tue Jan 09 07:18:49 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: termcap.c,v 1.36 2000/06/03 07:14:55 blymn Exp $       */
+/*     $NetBSD: termcap.c,v 1.37 2001/01/09 07:18:49 lukem Exp $       */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)termcap.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: termcap.c,v 1.36 2000/06/03 07:14:55 blymn Exp $");
+__RCSID("$NetBSD: termcap.c,v 1.37 2001/01/09 07:18:49 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -84,6 +84,9 @@
        char capability[256], *cap_ptr;
        size_t limit;
        
+       _DIAGASSERT(bp != NULL);
+       _DIAGASSERT(entry != NULL);
+
        if ((*bp = malloc(sizeof(struct tinfo))) == NULL)
                return -1;
 
diff -r 2b652711defe -r 1a7931263dd0 lib/libterm/tgoto.c
--- a/lib/libterm/tgoto.c       Tue Jan 09 06:36:13 2001 +0000
+++ b/lib/libterm/tgoto.c       Tue Jan 09 07:18:49 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tgoto.c,v 1.18 2000/12/13 22:14:40 scw Exp $   */
+/*     $NetBSD: tgoto.c,v 1.19 2001/01/09 07:18:50 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,10 +38,11 @@
 #if 0
 static char sccsid[] = "@(#)tgoto.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tgoto.c,v 1.18 2000/12/13 22:14:40 scw Exp $");
+__RCSID("$NetBSD: tgoto.c,v 1.19 2001/01/09 07:18:50 lukem Exp $");
 #endif
 #endif /* not lint */
 
+#include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <termcap.h>
@@ -115,6 +116,7 @@
        int which = destline;
 
        /* CM is checked below */
+       _DIAGASSERT(buffer != NULL);
 
        if (info != NULL)
        {
diff -r 2b652711defe -r 1a7931263dd0 lib/libterm/tputs.c
--- a/lib/libterm/tputs.c       Tue Jan 09 06:36:13 2001 +0000
+++ b/lib/libterm/tputs.c       Tue Jan 09 07:18:49 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tputs.c,v 1.17 2001/01/05 23:02:00 christos Exp $      */
+/*     $NetBSD: tputs.c,v 1.18 2001/01/09 07:18:50 lukem Exp $ */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)tputs.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tputs.c,v 1.17 2001/01/05 23:02:00 christos Exp $");
+__RCSID("$NetBSD: tputs.c,v 1.18 2001/01/09 07:18:50 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,6 +72,9 @@
 {
        int i = 0;
 
+       _DIAGASSERT(ptr != NULL);
+       _DIAGASSERT(*ptr != NULL);
+
        /*
         * Convert the number representing the delay.
         */
@@ -167,8 +170,12 @@
        char pad[2], *pptr;
        char *pc;
 
-       if (info != NULL)
-       {
+       /* XXX: info may be NULL ? */
+       /* cp is handled below */
+       _DIAGASSERT(outc != NULL);
+       _DIAGASSERT(args != NULL);
+
+       if (info != NULL) {
                /*
                 * if we have info then get the pad char from the
                 * termcap entry if it exists, otherwise use the



Home | Main Index | Thread Index | Old Index