mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* slint.c [HAVE_MAD] (dealloc_color_pairs): Move ...
* color.c [HAVE_MAD]: ... here and make accessible from other files to fix compilation. * color.h [HAVE_MAD]: Declare dealloc_color_pairs.
This commit is contained in:
parent
aeab4a933e
commit
e94799f762
@ -1,3 +1,10 @@
|
||||
2002-07-25 Andrew V. Samoilov <kai@cmail.ru>
|
||||
|
||||
* slint.c [HAVE_MAD] (dealloc_color_pairs): Move ...
|
||||
* color.c [HAVE_MAD]: ... here and make accessible from
|
||||
other files to fix compilation.
|
||||
* color.h [HAVE_MAD]: Declare dealloc_color_pairs.
|
||||
|
||||
2002-07-20 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* screen.c (panel_callback): Revert last change, it has bad side
|
||||
|
24
src/color.c
24
src/color.c
@ -305,11 +305,11 @@ alloc_color_pair (CTYPE foreground, CTYPE background)
|
||||
return max_index;
|
||||
}
|
||||
|
||||
struct colors_avail {
|
||||
static struct colors_avail {
|
||||
struct colors_avail *next;
|
||||
char *fg, *bg;
|
||||
int index;
|
||||
};
|
||||
} c = { 0, 0, 0, 0 };
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
void
|
||||
@ -328,7 +328,6 @@ mc_init_pair (int index, CTYPE foreground, CTYPE background)
|
||||
int
|
||||
try_alloc_color_pair (char *fg, char *bg)
|
||||
{
|
||||
static struct colors_avail c = { 0, 0, 0, 0 };
|
||||
struct colors_avail *p = &c;
|
||||
|
||||
c.index = EDITOR_NORMAL_COLOR_INDEX;
|
||||
@ -366,7 +365,6 @@ mc_init_pair (int index, CTYPE foreground, CTYPE background)
|
||||
int
|
||||
try_alloc_color_pair (char *fg, char *bg)
|
||||
{
|
||||
static struct colors_avail c = { 0, 0, 0, 0 };
|
||||
int fg_index, bg_index;
|
||||
int bold_attr;
|
||||
struct colors_avail *p = &c;
|
||||
@ -406,3 +404,21 @@ try_alloc_color_pair (char *fg, char *bg)
|
||||
}
|
||||
#endif /* !HAVE_SLANG */
|
||||
|
||||
#ifdef HAVE_MAD
|
||||
void
|
||||
dealloc_color_pairs (void)
|
||||
{
|
||||
struct colors_avail *p, *next;
|
||||
|
||||
for (p = c.next; p; p = next) {
|
||||
next = p->next;
|
||||
if (p->fg)
|
||||
g_free (p->fg);
|
||||
if (p->bg)
|
||||
g_free (p->bg);
|
||||
g_free (p);
|
||||
}
|
||||
c.next = NULL;
|
||||
}
|
||||
#endif /* HAVE_MAD */
|
||||
|
||||
|
@ -93,5 +93,8 @@ extern int dialog_colors [4];
|
||||
|
||||
void mc_init_pair (int index, CTYPE foreground, CTYPE background);
|
||||
int try_alloc_color_pair (char *fg, char *bg);
|
||||
#ifdef HAVE_MAD
|
||||
void dealloc_color_pairs (void);
|
||||
#endif
|
||||
|
||||
#endif /* __COLOR_H */
|
||||
|
21
src/slint.c
21
src/slint.c
@ -85,9 +85,6 @@ extern int SLsys_input_pending (int);
|
||||
|
||||
/* Forward declarations */
|
||||
static void load_terminfo_keys (void);
|
||||
#ifdef HAVE_MAD
|
||||
static void dealloc_color_pairs (void);
|
||||
#endif
|
||||
|
||||
static unsigned int SLang_getkey2 (void)
|
||||
{
|
||||
@ -367,24 +364,6 @@ vline (int character, int len)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_MAD
|
||||
static void
|
||||
dealloc_color_pairs (void)
|
||||
{
|
||||
struct colors_avail *p = c.next, *next;
|
||||
while (p) {
|
||||
next = p->next;
|
||||
if (p->fg)
|
||||
g_free (p->fg);
|
||||
if (p->bg)
|
||||
g_free (p->bg);
|
||||
g_free (p);
|
||||
p = next;
|
||||
}
|
||||
c.next = NULL;
|
||||
}
|
||||
#endif /* HAVE_MAD */
|
||||
|
||||
int has_colors (void)
|
||||
{
|
||||
char *terminal = getenv ("TERM");
|
||||
|
Loading…
Reference in New Issue
Block a user