diff options
-rw-r--r-- | src/option.c | 27 | ||||
-rw-r--r-- | src/proto/option.pro | 1 | ||||
-rw-r--r-- | src/term.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 29 insertions, 3 deletions
diff --git a/src/option.c b/src/option.c index 6eb7903295..a400eb6f3e 100644 --- a/src/option.c +++ b/src/option.c @@ -403,8 +403,9 @@ struct vimoption #define P_NUM 0x02 /* the option is numeric */ #define P_STRING 0x04 /* the option is a string */ #define P_ALLOCED 0x08 /* the string option is in allocated memory, - must use vim_free() when assigning new - value. Not set if default is the same. */ + must use free_string_option() when + assigning new value. Not set if default is + the same. */ #define P_EXPAND 0x10 /* environment expansion. NOTE: P_EXPAND can never be used for local or hidden options! */ #define P_NODEFAULT 0x40 /* don't set to default value */ @@ -8927,6 +8928,28 @@ free_termoptions() } /* + * Free the string for one term option, if it was allocated. + * Set the string to empty_option and clear allocated flag. + * "var" points to the option value. + */ + void +free_one_termoption(var) + char_u *var; +{ + struct vimoption *p; + + for (p = &options[0]; p->fullname != NULL; p++) + if (p->var == var) + { + if (p->flags & P_ALLOCED) + free_string_option(*(char_u **)(p->var)); + *(char_u **)(p->var) = empty_option; + p->flags &= ~P_ALLOCED; + break; + } +} + +/* * Set the terminal option defaults to the current value. * Used after setting the terminal name. */ diff --git a/src/proto/option.pro b/src/proto/option.pro index 39ee7be21a..9c58c3e9dc 100644 --- a/src/proto/option.pro +++ b/src/proto/option.pro @@ -29,6 +29,7 @@ int makeset __ARGS((FILE *fd, int opt_flags, int local_only)); int makefoldset __ARGS((FILE *fd)); void clear_termoptions __ARGS((void)); void free_termoptions __ARGS((void)); +void free_one_termoption __ARGS((char_u *var)); void set_term_defaults __ARGS((void)); void comp_col __ARGS((void)); char_u *get_equalprg __ARGS((void)); diff --git a/src/term.c b/src/term.c index 48e557ffda..f607575b14 100644 --- a/src/term.c +++ b/src/term.c @@ -2881,7 +2881,7 @@ ttest(pairs) /* if 'Sb' and 'AB' are not defined, reset "Co" */ if (*T_CSB == NUL && *T_CAB == NUL) - T_CCO = empty_option; + free_one_termoption(T_CCO); /* Set 'weirdinvert' according to value of 't_xs' */ p_wiv = (*T_XS != NUL); diff --git a/src/version.c b/src/version.c index 5f53901ec9..9f59ffd769 100644 --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 238, +/**/ 237, /**/ 236, |