Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses curses: declare SLK format as invalid until sl...
details: https://anonhg.NetBSD.org/src/rev/f7dca9570663
branches: trunk
changeset: 433789:f7dca9570663
user: roy <roy%NetBSD.org@localhost>
date: Thu Oct 04 18:40:41 2018 +0000
description:
curses: declare SLK format as invalid until slk_init(3) called
If we don't, then when __slk_init with a valid format of 0 it sets
up labels to be drawn without a window.
diffstat:
lib/libcurses/curses_private.h | 3 ++-
lib/libcurses/slk.c | 8 +++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diffs (53 lines):
diff -r 1765491c2fa0 -r f7dca9570663 lib/libcurses/curses_private.h
--- a/lib/libcurses/curses_private.h Thu Oct 04 15:21:23 2018 +0000
+++ b/lib/libcurses/curses_private.h Thu Oct 04 18:40:41 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses_private.h,v 1.65 2018/10/03 13:22:29 roy Exp $ */
+/* $NetBSD: curses_private.h,v 1.66 2018/10/04 18:40:41 roy Exp $ */
/*-
* Copyright (c) 1998-2000 Brett Lymn
@@ -289,6 +289,7 @@
bool is_term_slk;
WINDOW *slk_window;
int slk_format;
+#define SLK_FMT_INVAL -1
#define SLK_FMT_3_2_3 0
#define SLK_FMT_4_4 1
int slk_nlabels;
diff -r 1765491c2fa0 -r f7dca9570663 lib/libcurses/slk.c
--- a/lib/libcurses/slk.c Thu Oct 04 15:21:23 2018 +0000
+++ b/lib/libcurses/slk.c Thu Oct 04 18:40:41 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: slk.c,v 1.2 2017/01/30 17:15:52 roy Exp $ */
+/* $NetBSD: slk.c,v 1.3 2018/10/04 18:40:41 roy Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: slk.c,v 1.2 2017/01/30 17:15:52 roy Exp $");
+__RCSID("$NetBSD: slk.c,v 1.3 2018/10/04 18:40:41 roy Exp $");
#endif /* not lint */
#include <ctype.h>
@@ -57,7 +57,7 @@
#define SLK_SIZE MAX_SLK_COLS
#endif
-static int slk_fmt; /* fmt of slk_init */
+static int slk_fmt = SLK_FMT_INVAL; /* fmt of slk_init */
/* Safe variants of public functions. */
static int __slk_attron(SCREEN *, const chtype);
@@ -560,6 +560,8 @@
{
__slk_free(screen); /* safety */
+ if (slk_fmt == SLK_FMT_INVAL)
+ return OK;
screen->slk_format = slk_fmt;
switch(screen->slk_format) {
Home |
Main Index |
Thread Index |
Old Index