[PATCH] fix :reset to work with empty strings
As it turns out, mutt already handles all the option types
correctly except the string types: DT_STR, DT_PATH and DT_ADDR.
The following patch makes :reset work properly for all types,
tested with :reset all
# HG changeset patch
# User Aron Griffis <agriffis@xxxxxxxxx>
# Date 1248406601 14400
# Branch HEAD
# Node ID 1034d95a166a99316657b1ed83582a9be40b31fd
# Parent 1597c2074a5284c401a62ef52ed495d86bb09321
fix :reset to work with empty strings
Signed-off-by: Aron Griffis <agriffis@xxxxxxxxx>
diff -r 1597c2074a52 -r 1034d95a166a init.c
--- a/init.c Thu Jul 23 17:28:02 2009 +0200
+++ b/init.c Thu Jul 23 23:36:41 2009 -0400
@@ -1521,25 +1521,22 @@
switch (p->type & DT_MASK)
{
case DT_STR:
- if (p->init)
- mutt_str_replace ((char **) p->data, (char *) p->init);
+ mutt_str_replace ((char **) p->data, (char *) p->init);
break;
case DT_PATH:
+ FREE((char **) p->data);
if (p->init)
{
char path[_POSIX_PATH_MAX];
-
strfcpy (path, (char *) p->init, sizeof (path));
mutt_expand_path (path, sizeof (path));
- mutt_str_replace ((char **) p->data, path);
+ *((char **) p->data) = safe_strdup (path);
}
break;
case DT_ADDR:
+ rfc822_free_address ((ADDRESS **) p->data);
if (p->init)
- {
- rfc822_free_address ((ADDRESS **) p->data);
*((ADDRESS **) p->data) = rfc822_parse_adrlist (NULL, (char *) p->init);
- }
break;
case DT_BOOL:
if (p->init)