]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/new_pair.c
ncurses 6.1 - patch 20181229
[ncurses.git] / ncurses / base / new_pair.c
index bbccc19efa7953f3b1b4101c8e3452a512c54670..c47e61e7e8d7eeca4acadd9d7b2c78cecc4986f1 100644 (file)
@@ -60,7 +60,7 @@
 
 #endif
 
-MODULE_ID("$Id: new_pair.c,v 1.15 2018/03/01 15:02:12 tom Exp $")
+MODULE_ID("$Id: new_pair.c,v 1.17 2018/12/29 21:27:21 tom Exp $")
 
 #if NCURSES_EXT_COLORS
 
@@ -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;