/****************************************************************************
- * Copyright 2018-2019,2020 Thomas E. Dickey *
+ * Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#endif
-MODULE_ID("$Id: new_pair.c,v 1.20 2020/04/11 16:06:56 tom Exp $")
+MODULE_ID("$Id: new_pair.c,v 1.23 2021/08/16 22:11:26 tom Exp $")
#if NCURSES_EXT_COLORS
size_t have = sizeof(bigbuf);
_nc_STRCPY(p, tag, have);
- for (n = 0; n < sp->_pair_limit; ++n) {
+ for (n = 0; n < sp->_pair_alloc; ++n) {
if (list[n].mode != cpFREE) {
p += strlen(p);
if ((size_t) (p - bigbuf) + 50 > have)
{
colorpair_t find;
int result = -1;
- void *pp;
find.fg = fg;
find.bg = bg;
if (sp != 0) {
+ void *pp;
if ((pp = tfind(&find, &sp->_ordered_pairs, compare_data)) != 0) {
colorpair_t *temp = *(colorpair_t **) pp;
result = (int) (temp - sp->_color_pairs);
found = TRUE;
}
}
- if (!found) {
+ if (!found && SP_PARM->_color_pairs != NULL) {
for (pair = 1; pair <= hint; pair++) {
if (SP_PARM->_color_pairs[pair].mode == cpFREE) {
T(("found gap %d", pair));