# include "config.h"
#endif
+#include <lib-lib/mem.h>
+#include <lib-lib/macros.h>
+
#include "mutt.h"
#include "sort.h"
-
-#include "lib/mem.h"
-#include "lib/intl.h"
+#include "buffer.h"
#include <string.h>
#include <stdlib.h>
memset (buf, 0, sizeof (BUFFER));
mutt_extract_token (buf, s, 0);
if (MoreArgs (s)) {
- FREE (&pattern);
+ p_delete(&pattern);
strfcpy (err->data, _("score: too many arguments"), err->dsize);
return (-1);
}
/* look for an existing entry and update the value, else add it to the end
of the list */
for (ptr = Score, last = NULL; ptr; last = ptr, ptr = ptr->next)
- if (safe_strcmp (pattern, ptr->str) == 0)
+ if (str_cmp (pattern, ptr->str) == 0)
break;
if (!ptr) {
if ((pat = mutt_pattern_comp (pattern, 0, err)) == NULL) {
- FREE (&pattern);
+ p_delete(&pattern);
return (-1);
}
- ptr = safe_calloc (1, sizeof (SCORE));
+ ptr = p_new(SCORE, 1);
if (last)
last->next = ptr;
else
hdr->score = 0; /* in case of re-scoring */
for (tmp = Score; tmp; tmp = tmp->next) {
- if (mutt_pattern_exec (tmp->pat, 0, NULL, hdr) > 0) {
+ if (mutt_pattern_exec (tmp->pat, M_MATCH_FULL_ADDRESS, NULL, hdr) > 0) {
if (tmp->exact || tmp->val == 9999 || tmp->val == -9999) {
hdr->score = tmp->val;
break;
while (MoreArgs (s)) {
mutt_extract_token (buf, s, 0);
- if (!safe_strcmp ("*", buf->data)) {
+ if (!str_cmp ("*", buf->data)) {
for (tmp = Score; tmp;) {
last = tmp;
tmp = tmp->next;
mutt_pattern_free (&last->pat);
- FREE (&last);
+ p_delete(&last);
}
Score = NULL;
}
else {
for (tmp = Score; tmp; last = tmp, tmp = tmp->next) {
- if (!safe_strcmp (buf->data, tmp->str)) {
+ if (!str_cmp (buf->data, tmp->str)) {
if (last)
last->next = tmp->next;
else
Score = tmp->next;
mutt_pattern_free (&tmp->pat);
- FREE (&tmp);
+ p_delete(&tmp);
/* there should only be one score per pattern, so we can stop here */
break;
}