X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Fnew_pair.c;h=c47e61e7e8d7eeca4acadd9d7b2c78cecc4986f1;hp=f13d16f4575421c1cac5c9345b8c6ab06dfc257c;hb=bfe3845eb1a2ff02a740e917b537e939ec4e44cb;hpb=a20e6eb464be80b9cd8cae7ce925d27fe9c209ed;ds=sidebyside diff --git a/ncurses/base/new_pair.c b/ncurses/base/new_pair.c index f13d16f4..c47e61e7 100644 --- a/ncurses/base/new_pair.c +++ b/ncurses/base/new_pair.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2017 Free Software Foundation, Inc. * + * Copyright (c) 2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -48,7 +48,7 @@ #define MaxColors max_colors #endif -#if USE_NEW_PAIR +#if NCURSES_EXT_COLORS /* fix redefinition versys tic.h */ #undef entry @@ -60,9 +60,9 @@ #endif -MODULE_ID("$Id: new_pair.c,v 1.14 2017/08/11 18:20:22 tom Exp $") +MODULE_ID("$Id: new_pair.c,v 1.17 2018/12/29 21:27:21 tom Exp $") -#if USE_NEW_PAIR +#if NCURSES_EXT_COLORS #ifdef NEW_PAIR_DEBUG @@ -193,7 +193,8 @@ _nc_reset_color_pair(SCREEN *sp, int pair, colorpair_t * next) { colorpair_t *last; if (ValidPair(sp, pair)) { - last = _nc_reserve_pairs(sp, pair); + ReservePairs(sp, pair); + last = &(sp->_color_pairs[pair]); delink_color_pair(sp, pair); if (last->mode > cpFREE && (last->fg != next->fg || last->bg != next->bg)) { @@ -277,7 +278,8 @@ NCURSES_SP_NAME(alloc_pair) (NCURSES_SP_DCLx int fg, int bg) } if (!found && (SP_PARM->_pair_alloc < SP_PARM->_pair_limit)) { pair = SP_PARM->_pair_alloc; - if (_nc_reserve_pairs(sp, pair) == 0) { + ReservePairs(SP_PARM, pair); + if (SP_PARM->_color_pairs == 0) { pair = -1; } else { found = TRUE; @@ -376,4 +378,4 @@ void _nc_new_pair(void) { } -#endif /* USE_NEW_PAIR */ +#endif /* NCURSES_EXT_COLORS */