projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
From: David Champion <dgc@uchicago.edu>
[apps/madmutt.git]
/
color.c
diff --git
a/color.c
b/color.c
index
9270516
..
5484bba
100644
(file)
--- a/
color.c
+++ b/
color.c
@@
-12,6
+12,8
@@
#endif
#include "mutt.h"
#endif
#include "mutt.h"
+#include "buffer.h"
+#include "ascii.h"
#include "mutt_curses.h"
#include "mapping.h"
#include "mutt_curses.h"
#include "mapping.h"
@@
-96,7
+98,7
@@
static struct mapping_t Fields[] = {
static COLOR_LINE *mutt_new_color_line (void)
{
static COLOR_LINE *mutt_new_color_line (void)
{
- COLOR_LINE *p =
safe
_calloc (1, sizeof (COLOR_LINE));
+ COLOR_LINE *p =
mem
_calloc (1, sizeof (COLOR_LINE));
p->fg = p->bg = -1;
p->fg = p->bg = -1;
@@
-123,14
+125,14
@@
static void mutt_free_color_line (COLOR_LINE ** l, int free_colors)
regfree (&tmp->rx);
mutt_pattern_free (&tmp->color_pattern);
regfree (&tmp->rx);
mutt_pattern_free (&tmp->color_pattern);
-
FREE
(&tmp->pattern);
-
FREE
(l);
+
mem_free
(&tmp->pattern);
+
mem_free
(l);
}
void ci_start_color (void)
{
memset (ColorDefs, A_NORMAL, sizeof (int) * MT_COLOR_MAX);
}
void ci_start_color (void)
{
memset (ColorDefs, A_NORMAL, sizeof (int) * MT_COLOR_MAX);
- ColorQuote = (int *)
safe
_malloc (COLOR_QUOTE_INIT * sizeof (int));
+ ColorQuote = (int *)
mem
_malloc (COLOR_QUOTE_INIT * sizeof (int));
memset (ColorQuote, A_NORMAL, sizeof (int) * COLOR_QUOTE_INIT);
ColorQuoteSize = COLOR_QUOTE_INIT;
ColorQuoteUsed = 0;
memset (ColorQuote, A_NORMAL, sizeof (int) * COLOR_QUOTE_INIT);
ColorQuoteSize = COLOR_QUOTE_INIT;
ColorQuoteUsed = 0;
@@
-223,7
+225,7
@@
int mutt_alloc_color (int fg, int bg)
i++;
}
i++;
}
- p = (COLOR_LIST *)
safe
_malloc (sizeof (COLOR_LIST));
+ p = (COLOR_LIST *)
mem
_malloc (sizeof (COLOR_LIST));
p->next = ColorList;
ColorList = p;
p->next = ColorList;
ColorList = p;
@@
-267,14
+269,14
@@
void mutt_free_color (int fg, int bg)
if (p == ColorList) {
ColorList = ColorList->next;
if (p == ColorList) {
ColorList = ColorList->next;
-
FREE
(&p);
+
mem_free
(&p);
return;
}
q = ColorList;
while (q) {
if (q->next == p) {
q->next = p->next;
return;
}
q = ColorList;
while (q) {
if (q->next == p) {
q->next = p->next;
-
FREE
(&p);
+
mem_free
(&p);
return;
}
q = q->next;
return;
}
q = q->next;
@@
-295,13
+297,13
@@
parse_color_name (const char *s, int *col, int *attr, int brite, BUFFER * err)
{
char *eptr;
{
char *eptr;
- if (s
afe_str
ncasecmp (s, "bright", 6) == 0) {
+ if (s
tr_
ncasecmp (s, "bright", 6) == 0) {
*attr |= brite;
s += 6;
}
/* allow aliases for xterm color resources */
*attr |= brite;
s += 6;
}
/* allow aliases for xterm color resources */
- if (s
afe_str
ncasecmp (s, "color", 5) == 0) {
+ if (s
tr_
ncasecmp (s, "color", 5) == 0) {
s += 5;
*col = strtol (s, &eptr, 10);
if (!*s || *eptr || *col < 0 ||
s += 5;
*col = strtol (s, &eptr, 10);
if (!*s || *eptr || *col < 0 ||
@@
-361,7
+363,7
@@
_mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
return (-1);
}
return (-1);
}
- if (s
afe_str
ncmp (buf->data, "index", 5) != 0) {
+ if (s
tr_
ncmp (buf->data, "index", 5) != 0) {
snprintf (err->data, err->dsize,
_("%s: command valid only for index object"),
parse_uncolor ? "uncolor" : "unmono");
snprintf (err->data, err->dsize,
_("%s: command valid only for index object"),
parse_uncolor ? "uncolor" : "unmono");
@@
-399,7
+401,7
@@
_mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
do {
mutt_extract_token (buf, s, 0);
do {
mutt_extract_token (buf, s, 0);
- if (!s
afe_str
cmp ("*", buf->data)) {
+ if (!s
tr_
cmp ("*", buf->data)) {
for (tmp = ColorIndexList; tmp;) {
if (!do_cache)
do_cache = 1;
for (tmp = ColorIndexList; tmp;) {
if (!do_cache)
do_cache = 1;
@@
-412,7
+414,7
@@
_mutt_parse_uncolor (BUFFER * buf, BUFFER * s, unsigned long data,
else {
for (last = NULL, tmp = ColorIndexList; tmp;
last = tmp, tmp = tmp->next) {
else {
for (last = NULL, tmp = ColorIndexList; tmp;
last = tmp, tmp = tmp->next) {
- if (!s
afe_str
cmp (buf->data, tmp->pattern)) {
+ if (!s
tr_
cmp (buf->data, tmp->pattern)) {
if (!do_cache)
do_cache = 1;
debug_print (1, ("Freeing pattern \"%s\" from ColorIndexList\n", tmp->pattern));
if (!do_cache)
do_cache = 1;
debug_print (1, ("Freeing pattern \"%s\" from ColorIndexList\n", tmp->pattern));
@@
-454,11
+456,11
@@
add_pattern (COLOR_LINE ** top, const char *s, int sensitive,
while (tmp) {
if (sensitive) {
while (tmp) {
if (sensitive) {
- if (s
afe_str
cmp (s, tmp->pattern) == 0)
+ if (s
tr_
cmp (s, tmp->pattern) == 0)
break;
}
else {
break;
}
else {
- if (s
afe_str
casecmp (s, tmp->pattern) == 0)
+ if (s
tr_
casecmp (s, tmp->pattern) == 0)
break;
}
tmp = tmp->next;
break;
}
tmp = tmp->next;
@@
-507,7
+509,7
@@
add_pattern (COLOR_LINE ** top, const char *s, int sensitive,
return (-1);
}
tmp->next = *top;
return (-1);
}
tmp->next = *top;
- tmp->pattern = s
afe_str
dup (s);
+ tmp->pattern = s
tr_
dup (s);
#ifdef HAVE_COLOR
if (fg != -1 && bg != -1) {
tmp->fg = fg;
#ifdef HAVE_COLOR
if (fg != -1 && bg != -1) {
tmp->fg = fg;
@@
-534,7
+536,7
@@
parse_object (BUFFER * buf, BUFFER * s, int *o, int *ql, BUFFER * err)
}
mutt_extract_token (buf, s, 0);
}
mutt_extract_token (buf, s, 0);
- if (!s
afe_str
ncmp (buf->data, "quoted", 6)) {
+ if (!s
tr_
ncmp (buf->data, "quoted", 6)) {
if (buf->data[6]) {
*ql = strtol (buf->data + 6, &eptr, 10);
if (*eptr || q_level < 0) {
if (buf->data[6]) {
*ql = strtol (buf->data + 6, &eptr, 10);
if (*eptr || q_level < 0) {
@@
-698,7
+700,7
@@
_mutt_parse_color (BUFFER * buf, BUFFER * s, BUFFER * err,
}
else if (object == MT_COLOR_QUOTED) {
if (q_level >= ColorQuoteSize) {
}
else if (object == MT_COLOR_QUOTED) {
if (q_level >= ColorQuoteSize) {
-
safe
_realloc (&ColorQuote, (ColorQuoteSize += 2) * sizeof (int));
+
mem
_realloc (&ColorQuote, (ColorQuoteSize += 2) * sizeof (int));
ColorQuote[ColorQuoteSize - 2] = ColorDefs[MT_COLOR_QUOTED];
ColorQuote[ColorQuoteSize - 1] = ColorDefs[MT_COLOR_QUOTED];
}
ColorQuote[ColorQuoteSize - 2] = ColorDefs[MT_COLOR_QUOTED];
ColorQuote[ColorQuoteSize - 1] = ColorDefs[MT_COLOR_QUOTED];
}