]> granicus.if.org Git - neomutt/commitdiff
alias drop self 926/head
authorRichard Russon <rich@flatcap.org>
Sat, 4 Nov 2017 14:31:54 +0000 (14:31 +0000)
committerRichard Russon <rich@flatcap.org>
Tue, 7 Nov 2017 13:48:46 +0000 (13:48 +0000)
struct Alias began:

```c
struct Alias
{
  struct Alias *self; /* XXX - ugly hack */
  ...
```

There didn't seem to be any reason for this pointer.
The two places that allocate a new Alias, immediately set the self
pointer to the object.  No users of `self` test it first.

addrbook.c
alias.c
alias.h
init.c

index 3723ac8bd36983c071d5d15030952beb6e5ff64e..186d34a7d876f34d7740154f56510797519f8622 100644 (file)
@@ -168,8 +168,8 @@ new_aliases:
   /* count the number of aliases */
   for (aliasp = aliases; aliasp; aliasp = aliasp->next)
   {
-    aliasp->self->del = false;
-    aliasp->self->tagged = false;
+    aliasp->del = false;
+    aliasp->tagged = false;
     menu->max++;
   }
 
@@ -180,7 +180,7 @@ new_aliases:
 
   for (i = omax, aliasp = aliases; aliasp; aliasp = aliasp->next, i++)
   {
-    AliasTable[i] = aliasp->self;
+    AliasTable[i] = aliasp;
     aliases = aliasp;
   }
 
@@ -215,7 +215,7 @@ new_aliases:
         }
         else
         {
-          AliasTable[menu->current]->self->del = (op == OP_DELETE);
+          AliasTable[menu->current]->del = (op == OP_DELETE);
           menu->redraw |= REDRAW_CURRENT;
           if (option(OPT_RESOLVE) && menu->current < menu->max - 1)
           {
diff --git a/alias.c b/alias.c
index 39bf695556f79f012713b92f523924227a3ef659..e77c4d5baa18869ec9e27fed18629c644968a19d 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -337,7 +337,6 @@ retry_name:
   }
 
   new = safe_calloc(1, sizeof(struct Alias));
-  new->self = new;
   new->name = safe_strdup(buf);
 
   mutt_addrlist_to_local(adr);
diff --git a/alias.h b/alias.h
index 25801cb6aeee9a57c21076f79401dbca5d4c81bd..f990434e5982c84bc1bdc610150ae616317350ca 100644 (file)
--- a/alias.h
+++ b/alias.h
@@ -33,7 +33,6 @@ struct Address;
  */
 struct Alias
 {
-  struct Alias *self; /* XXX - ugly hack */
   char *name;
   struct Address *addr;
   struct Alias *next;
diff --git a/init.c b/init.c
index e5aea3f939f34f5885ee95ea8c59a5573b156fa6..aadd7214c3eadcd45688d490a57c128ef70e735d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1916,7 +1916,6 @@ static int parse_alias(struct Buffer *buf, struct Buffer *s, unsigned long data,
   {
     /* create a new alias */
     tmp = safe_calloc(1, sizeof(struct Alias));
-    tmp->self = tmp;
     tmp->name = safe_strdup(buf->data);
     /* give the main addressbook code a chance */
     if (CurrentMenu == MENU_ALIAS)