struct hash_elem *ptr = table->table[hash];
struct hash_elem **last = &table->table[hash];
- for (; ptr; last = &ptr->next, ptr = ptr->next)
+ while (ptr)
{
- /* if `data' is given, look for a matching ->data member. this is
- * required for the case where we have multiple entries with the same
- * key
- */
- if ((data == ptr->data) || (!data && mutt_strcmp (ptr->key, key) == 0))
+ if ((data == ptr->data || !data)
+ && mutt_strcmp (ptr->key, key) == 0)
{
*last = ptr->next;
- if (destroy) destroy (ptr->data);
+ if (destroy)
+ destroy (ptr->data);
FREE (&ptr);
- return;
+
+ ptr = *last;
+ }
+ else
+ {
+ last = &ptr->next;
+ ptr = ptr->next;
}
}
}
fclose(fp);
if (ctx->msgcount > oldmsgcount)
+ {
+ mx_alloc_memory(ctx);
mx_update_context (ctx, ctx->msgcount - oldmsgcount);
+ }
return msgend;
}
hash_delete (ctx->id_hash, h->env->message_id, h, NULL);
if (ctx->subj_hash && h->env->real_subj)
hash_delete (ctx->subj_hash, h->env->real_subj, h, NULL);
+ if (ctx->thread_hash && h->env->message_id)
+ hash_delete (ctx->thread_hash, h->env->message_id, NULL, NULL);
mutt_free_envelope (&h->env);
h->env = mutt_read_rfc822_header (msg->fp, h, 0, 0);
if (ctx->id_hash && h->env->message_id)
{
*c = '\0';
strfcpy (mx->account.user, tmp, sizeof (mx->account.user));
- strfcpy (tmp, c+1, sizeof (tmp));
+ c++;
mx->account.flags |= M_ACCT_USER;
}
- if ((n = sscanf (tmp, "%127[^:/]%127s", mx->account.host, tmp)) < 1)
+ if ((n = sscanf (c, "%127[^:/]%127s", mx->account.host, c)) < 1)
{
dprint (1, (debugfile, "imap_parse_path: NULL host in %s\n", path));
FREE (&mx->mbox);
}
if (n > 1) {
- if (sscanf (tmp, ":%hu%127s", &(mx->account.port), tmp) >= 1)
+ if (sscanf (c, ":%hu%127s", &(mx->account.port), c) >= 1)
mx->account.flags |= M_ACCT_PORT;
- if (sscanf (tmp, "/%s", tmp) == 1)
+ if (sscanf (c, "/%s", c) == 1)
{
- if (!ascii_strncmp (tmp, "ssl", 3))
+ if (!ascii_strncmp (c, "ssl", 3))
mx->account.flags |= M_ACCT_SSL;
else
{