mutt_*mktemp--
[apps/madmutt.git] / score.c
diff --git a/score.c b/score.c
index 4bc13e6..f782391 100644 (file)
--- a/score.c
+++ b/score.c
@@ -7,19 +7,10 @@
  * please see the file GPL in the top level source directory.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <lib-lib/lib-lib.h>
 
 #include "mutt.h"
 #include "sort.h"
-#include "buffer.h"
-
-#include "lib/mem.h"
-#include "lib/intl.h"
-
-#include <string.h>
-#include <stdlib.h>
 
 typedef struct score_t {
   char *str;
@@ -64,29 +55,29 @@ int mutt_parse_score (BUFFER * buf, BUFFER * s, unsigned long data,
 
   mutt_extract_token (buf, s, 0);
   if (!MoreArgs (s)) {
-    strfcpy (err->data, _("score: too few arguments"), err->dsize);
+    m_strcpy(err->data, err->dsize, _("score: too few arguments"));
     return (-1);
   }
   pattern = buf->data;
-  memset (buf, 0, sizeof (BUFFER));
+  p_clear(buf, 1);
   mutt_extract_token (buf, s, 0);
   if (MoreArgs (s)) {
-    mem_free (&pattern);
-    strfcpy (err->data, _("score: too many arguments"), err->dsize);
+    p_delete(&pattern);
+    m_strcpy(err->data, err->dsize, _("score: too many arguments"));
     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 (str_cmp (pattern, ptr->str) == 0)
+    if (m_strcmp(pattern, ptr->str) == 0)
       break;
   if (!ptr) {
     if ((pat = mutt_pattern_comp (pattern, 0, err)) == NULL) {
-      mem_free (&pattern);
+      p_delete(&pattern);
       return (-1);
     }
-    ptr = mem_calloc (1, sizeof (SCORE));
+    ptr = p_new(SCORE, 1);
     if (last)
       last->next = ptr;
     else
@@ -110,7 +101,7 @@ void mutt_score_message (CONTEXT * ctx, HEADER * hdr, int upd_ctx)
 
   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;
@@ -136,24 +127,24 @@ int mutt_parse_unscore (BUFFER * buf, BUFFER * s, unsigned long data,
 
   while (MoreArgs (s)) {
     mutt_extract_token (buf, s, 0);
-    if (!str_cmp ("*", buf->data)) {
+    if (!m_strcmp("*", buf->data)) {
       for (tmp = Score; tmp;) {
         last = tmp;
         tmp = tmp->next;
         mutt_pattern_free (&last->pat);
-        mem_free (&last);
+        p_delete(&last);
       }
       Score = NULL;
     }
     else {
       for (tmp = Score; tmp; last = tmp, tmp = tmp->next) {
-        if (!str_cmp (buf->data, tmp->str)) {
+        if (!m_strcmp(buf->data, tmp->str)) {
           if (last)
             last->next = tmp->next;
           else
             Score = tmp->next;
           mutt_pattern_free (&tmp->pat);
-          mem_free (&tmp);
+          p_delete(&tmp);
           /* there should only be one score per pattern, so we can stop here */
           break;
         }