- * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. *
+ * Copyright 2018-2019,2020 Thomas E. Dickey *
+ * Copyright 1998-2016,2017 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 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* allow for default-color as a component of a color-pair.
*/
SP_PARM->_pair_limit += (1 + (2 * maxcolors));
* allow for default-color as a component of a color-pair.
*/
SP_PARM->_pair_limit += (1 + (2 * maxcolors));
- if ((sp->_color_pairs != 0) && (want < sp->_pair_alloc)) {
- result = &(sp->_color_pairs[want]);
- } else {
-
- if (have == 0)
- have = 1;
- while (have <= want)
- have *= 2;
- if (have > sp->_pair_limit)
- have = sp->_pair_limit;
+ if (have == 0)
+ have = 1;
+ while (have <= want)
+ have *= 2;
+ if (have > sp->_pair_limit)
+ have = sp->_pair_limit;
- if (sp->_color_pairs == 0) {
- sp->_color_pairs = TYPE_CALLOC(colorpair_t, have);
- } else if (have > sp->_pair_alloc) {
+ if (sp->_color_pairs == 0) {
+ sp->_color_pairs = TYPE_CALLOC(colorpair_t, have);
+ } else if (have > sp->_pair_alloc) {
- colorpair_t *next;
-
- if ((next = typeCalloc(colorpair_t, have)) == 0)
- _nc_err_abort(MSG_NO_MEMORY);
- memcpy(next, sp->_color_pairs, (size_t) sp->_pair_alloc * sizeof(*next));
- _nc_copy_pairs(sp, next, sp->_color_pairs, sp->_pair_alloc);
- free(sp->_color_pairs);
- sp->_color_pairs = next;
+ colorpair_t *next;
+
+ if ((next = typeCalloc(colorpair_t, have)) == 0)
+ _nc_err_abort(MSG_NO_MEMORY);
+ memcpy(next, sp->_color_pairs, (size_t) sp->_pair_alloc * sizeof(*next));
+ _nc_copy_pairs(sp, next, sp->_color_pairs, sp->_pair_alloc);
+ free(sp->_color_pairs);
+ sp->_color_pairs = next;
- TYPE_REALLOC(colorpair_t, have, sp->_color_pairs);
- if (sp->_color_pairs != 0) {
- memset(sp->_color_pairs + sp->_pair_alloc, 0,
- sizeof(colorpair_t) * (size_t) (have - sp->_pair_alloc));
- }
-#endif
- }
+ TYPE_REALLOC(colorpair_t, have, sp->_color_pairs);
- sp->_pair_alloc = have;
- result = &(sp->_color_pairs[want]);
+ memset(sp->_color_pairs + sp->_pair_alloc, 0,
+ sizeof(colorpair_t) * (size_t) (have - sp->_pair_alloc));
(int) tp[b].red, (int) tp[b].green, (int) tp[b].blue));
NCURSES_PUTP2("initialize_pair",
(int) tp[b].red, (int) tp[b].green, (int) tp[b].blue));
NCURSES_PUTP2("initialize_pair",
CallDriver_4(sp, td_initcolor, color, r, g, b);
#else
NCURSES_PUTP2("initialize_color",
CallDriver_4(sp, td_initcolor, color, r, g, b);
#else
NCURSES_PUTP2("initialize_color",
- TPARM_4(initialize_color, color, r, g, b));
+ TIPARM_4(initialize_color, color, r, g, b));
free(SP_PARM->_color_pairs);
SP_PARM->_color_pairs = 0;
SP_PARM->_pair_alloc = 0;
free(SP_PARM->_color_pairs);
SP_PARM->_color_pairs = 0;
SP_PARM->_pair_alloc = 0;
clearok(CurScreen(SP_PARM), TRUE);
touchwin(StdScreen(SP_PARM));
}
clearok(CurScreen(SP_PARM), TRUE);
touchwin(StdScreen(SP_PARM));
}