there is no real need for a lib-hash anymore. fold it.
[apps/madmutt.git] / pager.c
diff --git a/pager.c b/pager.c
index a25490c..966955c 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -12,7 +12,6 @@
  */
 
 #include <lib-lib/lib-lib.h>
-#include <lib-crypt/crypt.h>
 
 #include <lib-ui/curses.h>
 #include <lib-ui/enter.h>
@@ -21,6 +20,7 @@
 #include <lib-mx/mx.h>
 
 #include "mutt.h"
+#include "crypt.h"
 #include "alias.h"
 #include "keymap.h"
 #include "sort.h"
@@ -217,16 +217,13 @@ resolve_color (struct line_t *lineInfo, int n, int cnt, int flags,
 
   /* handle "special" bold & underlined characters */
   if (special || a->attr) {
-#ifdef HAVE_COLOR
     if ((a->attr & ANSI_COLOR)) {
       if (a->pair == -1)
         a->pair = mutt_alloc_color (a->fg, a->bg);
       color = a->pair;
       if (a->attr & ANSI_BOLD)
         color |= A_BOLD;
-    }
-    else
-#endif
+    } else
     if ((special & A_BOLD) || (a->attr & ANSI_BOLD)) {
       if (ColorDefs[MT_COLOR_BOLD] && !search)
         color = ColorDefs[MT_COLOR_BOLD];
@@ -314,21 +311,15 @@ shift_class_colors (struct q_class_t *QuoteList, struct q_class_t *new_class,
   (*q_level)++;
 }
 
-static void cleanup_quote (struct q_class_t **QuoteList)
+static void cleanup_quote(struct q_class_t **QuoteList)
 {
-  struct q_class_t *ptr;
-
-  while (*QuoteList) {
-    if ((*QuoteList)->down)
-      cleanup_quote (&((*QuoteList)->down));
-    ptr = (*QuoteList)->next;
-    if ((*QuoteList)->prefix)
-      p_delete(&(*QuoteList)->prefix);
-    p_delete(QuoteList);
-    *QuoteList = ptr;
-  }
-
-  return;
+    while (*QuoteList) {
+        struct q_class_t *ptr = (*QuoteList)->next;
+        cleanup_quote(&(*QuoteList)->down);
+        p_delete(&(*QuoteList)->prefix);
+        p_delete(QuoteList);
+        *QuoteList = ptr;
+    }
 }
 
 static struct q_class_t *classify_quote (struct q_class_t **QuoteList,
@@ -771,10 +762,8 @@ static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a)
   /* Character Attributes */
   if (option (OPTALLOWANSI) && a != NULL && buf[x] == 'm') {
     if (pos == x) {
-#ifdef HAVE_COLOR
       if (a->pair != -1)
         mutt_free_color (a->fg, a->bg);
-#endif
       a->attr = ANSI_OFF;
       a->pair = -1;
     }
@@ -803,10 +792,8 @@ static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a)
         pos += 2;
       }
       else if (buf[pos] == '3' && isdigit (buf[pos + 1])) {
-#ifdef HAVE_COLOR
         if (a->pair != -1)
           mutt_free_color (a->fg, a->bg);
-#endif
         a->pair = -1;
         a->attr |= ANSI_COLOR;
         if (buf[pos + 1] != '9')
@@ -814,10 +801,8 @@ static int grok_ansi (unsigned char *buf, int pos, ansi_attr * a)
         pos += 3;
       }
       else if (buf[pos] == '4' && isdigit (buf[pos + 1])) {
-#ifdef HAVE_COLOR
         if (a->pair != -1)
           mutt_free_color (a->fg, a->bg);
-#endif
         a->pair = -1;
         a->attr |= ANSI_COLOR;
         if (buf[pos + 1] != '9')
@@ -1683,8 +1668,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
           lineInfo[i].quote = NULL;
 
           p_realloc(&lineInfo[i].syntax, 1);
-          if (SearchCompiled && lineInfo[i].search)
-            p_delete(&(lineInfo[i].search));
+          if (SearchCompiled)
+            p_delete(&lineInfo[i].search);
         }
 
         lastLine = 0;
@@ -1857,8 +1842,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
       if (SearchCompiled) {
         regfree (&SearchRE);
         for (i = 0; i < lastLine; i++) {
-          if (lineInfo[i].search)
-            p_delete(&(lineInfo[i].search));
+          p_delete(&lineInfo[i].search);
           lineInfo[i].search_cnt = -1;
         }
       }
@@ -1871,8 +1855,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
         regfree (&SearchRE);
         for (i = 0; i < maxLine; i++) {
           /* cleanup */
-          if (lineInfo[i].search)
-            p_delete(&(lineInfo[i].search));
+          p_delete(&lineInfo[i].search);
           lineInfo[i].search_cnt = -1;
         }
         SearchFlag = 0;
@@ -2161,8 +2144,8 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
           lineInfo[i].quote = NULL;
 
           p_realloc(&(lineInfo[i].syntax), 1);
-          if (SearchCompiled && lineInfo[i].search)
-            p_delete(&(lineInfo[i].search));
+          if (SearchCompiled)
+            p_delete(&lineInfo[i].search);
         }
 
         if (SearchCompiled) {
@@ -2487,19 +2470,6 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
       redraw = REDRAW_FULL;
       break;
 
-
-    case OP_MAIL_KEY:
-      CHECK_MODE (IsHeader (extra));
-      CHECK_ATTACH;
-      ci_send_message (SENDKEY, NULL, NULL, extra->ctx, extra->hdr);
-      redraw = REDRAW_FULL;
-      break;
-
-
-    case OP_FORGET_PASSPHRASE:
-      crypt_forget_passphrase ();
-      break;
-
     case OP_EXTRACT_KEYS:
       CHECK_MODE (IsHeader (extra));
       crypt_extract_keys_from_messages (extra->hdr);
@@ -2531,12 +2501,12 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
     }
   }
 
-  cleanup_quote (&QuoteList);
+  cleanup_quote(&QuoteList);
 
   for (i = 0; i < maxLine; i++) {
-    p_delete(&(lineInfo[i].syntax));
-    if (SearchCompiled && lineInfo[i].search)
-      p_delete(&(lineInfo[i].search));
+    p_delete(&lineInfo[i].syntax);
+    if (SearchCompiled)
+      p_delete(&lineInfo[i].search);
   }
   if (SearchCompiled) {
     regfree (&SearchRE);