return (r);
}
-/* Heap structure
+/* Stack structure
* FILO designed to contain the list of config files that have been sourced
* and avoid cyclic sourcing */
-static HEAP *MuttrcHeap;
+static LIST *MuttrcStack;
/* Use POSIX functions to convert a path to absolute, relatively to another path
* Args:
if (rcfile[rcfilelen-1] != '|')
{
- if (!to_absolute_path(rcfile, mutt_front_heap(MuttrcHeap)))
+ if (!to_absolute_path(rcfile, mutt_front_list(MuttrcStack)))
{
mutt_error("Error: impossible to build path of '%s'.", rcfile_path);
return (-1);
}
- if (!MuttrcHeap || mutt_find_heap(MuttrcHeap, rcfile) == NULL)
+ if (!MuttrcStack || mutt_find_list(MuttrcStack, rcfile) == NULL)
{
- mutt_push_heap(&MuttrcHeap, rcfile);
+ mutt_push_list(&MuttrcStack, rcfile);
}
else
{
rc = -1;
}
- mutt_pop_heap(&MuttrcHeap);
+ mutt_pop_list(&MuttrcStack);
return (rc);
}
struct list_t *next;
} LIST;
-typedef struct list_t HEAP;
-
typedef struct rx_list_t
{
REGEXP *rx;
return safe_calloc (1, sizeof (LIST));
}
-inline HEAP *mutt_new_heap()
-{
- return safe_calloc (1, sizeof (HEAP));
-}
-
inline RX_LIST *mutt_new_rx_list()
{
return safe_calloc (1, sizeof (RX_LIST));
LIST *mutt_find_list (LIST *, const char *);
int mutt_remove_from_rx_list (RX_LIST **l, const char *str);
-/* handle heap */
-void mutt_push_heap(HEAP **head, const char *data);
-int mutt_pop_heap(HEAP **head);
-const char *mutt_front_heap(HEAP *head);
-HEAP *mutt_find_heap(HEAP *head, const char *data);
+/* handle stack */
+void mutt_push_list(LIST **head, const char *data);
+int mutt_pop_list(LIST **head);
+const char *mutt_front_list(LIST *head);
void mutt_init (int, LIST *);
* External definitions for inline functions in mutt.h
*/
extern LIST *mutt_new_list();
-extern HEAP *mutt_new_heap();
extern RX_LIST *mutt_new_rx_list();
extern SPAM_LIST *mutt_new_spam_list();
extern PARAMETER *mutt_new_parameter();
return NULL;
}
-void mutt_push_heap(HEAP **head, const char *data)
+void mutt_push_list(LIST **head, const char *data)
{
- HEAP *tmp;
- tmp = safe_malloc(sizeof(HEAP));
+ LIST *tmp;
+ tmp = safe_malloc(sizeof(LIST));
tmp->data = safe_strdup(data);
tmp->next = *head;
*head = tmp;
}
-int mutt_pop_heap(HEAP **head)
+int mutt_pop_list(LIST **head)
{
- HEAP *elt = *head;
+ LIST *elt = *head;
if (!elt)
return 0;
*head = elt->next;
return 1;
}
-const char *mutt_front_heap(HEAP *head)
+const char *mutt_front_list(LIST *head)
{
if (!head || !head->data)
return "";
return head->data;
}
-HEAP *mutt_find_heap(HEAP *head, const char *data)
-{
- return (HEAP *) mutt_find_list((LIST *) head, data);
-}
-
int mutt_remove_from_rx_list (RX_LIST **l, const char *str)
{
RX_LIST *p, *last = NULL;