X-Git-Url: http://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=ncurses%2Fbase%2Flib_color.c;h=b61d44a6a46f51bc61fd237ac161d02a7e6785ac;hb=414771292d2331e48bc09f49813998adc33929e2;hp=e4276784f8fed6d5ffd25510c19ae4fd9cfd7f1c;hpb=56a81c7e79f73d397cc8074401d039f59c34cad5;p=ncurses.git diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index e4276784..b61d44a6 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_color.c,v 1.147 2021/05/08 15:11:48 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.149 2022/04/30 18:36:54 tom Exp $") #ifdef USE_TERM_DRIVER #define CanChange InfoOf(SP_PARM).canchange @@ -94,8 +94,6 @@ NCURSES_EXPORT_VAR(int) COLORS = 0; #define DATA(r,g,b) {r,g,b, 0,0,0, 0} -#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) - #define MAX_PALETTE 8 #define OkColorHi(n) (((n) < COLORS) && ((n) < maxcolors)) @@ -412,7 +410,7 @@ NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0) if (init_direct_colors(NCURSES_SP_ARG)) { result = OK; } else { - SP_PARM->_color_table = TYPE_CALLOC(color_t, maxcolors); + TYPE_CALLOC(color_t, maxcolors, SP_PARM->_color_table); if (SP_PARM->_color_table != 0) { MakeColorPair(SP_PARM->_color_pairs[0], default_fg(NCURSES_SP_ARG), @@ -529,7 +527,7 @@ _nc_reserve_pairs(SCREEN *sp, int want) have = sp->_pair_limit; if (sp->_color_pairs == 0) { - sp->_color_pairs = TYPE_CALLOC(colorpair_t, have); + TYPE_CALLOC(colorpair_t, have, sp->_color_pairs); } else if (have > sp->_pair_alloc) { #if NCURSES_EXT_COLORS colorpair_t *next; @@ -831,7 +829,6 @@ static int _nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b) { int result = ERR; - int maxcolors; T((T_CALLED("color_content(%p,%d,%p,%p,%p)"), (void *) sp, @@ -841,7 +838,7 @@ _nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b) (void *) b)); if (sp != 0) { - maxcolors = MaxColors; + int maxcolors = MaxColors; if (color >= 0 && OkColorHi(color) && sp->_coloron) { int c_r, c_g, c_b;