]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.238
- updated to 7.2.330
[packages/vim.git] / 7.2.238
1 To: vim-dev@vim.org
2 Subject: Patch 7.2.238
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.2.238
11 Problem:    Leaking memory when setting term to "builtin_dumb".
12 Solution:   Free memory when resetting term option t_Co.
13 Files:      src/option.c, src/proto/option.pro, src/term.c
14
15
16 *** ../vim-7.2.237/src/option.c 2009-06-16 17:50:56.000000000 +0200
17 --- src/option.c        2009-07-22 12:49:19.000000000 +0200
18 ***************
19 *** 403,410 ****
20   #define P_NUM         0x02    /* the option is numeric */
21   #define P_STRING      0x04    /* the option is a string */
22   #define P_ALLOCED     0x08    /* the string option is in allocated memory,
23 !                                   must use vim_free() when assigning new
24 !                                   value. Not set if default is the same. */
25   #define P_EXPAND      0x10    /* environment expansion.  NOTE: P_EXPAND can
26                                    never be used for local or hidden options! */
27   #define P_NODEFAULT   0x40    /* don't set to default value */
28 --- 403,411 ----
29   #define P_NUM         0x02    /* the option is numeric */
30   #define P_STRING      0x04    /* the option is a string */
31   #define P_ALLOCED     0x08    /* the string option is in allocated memory,
32 !                                  must use free_string_option() when
33 !                                  assigning new value. Not set if default is
34 !                                  the same. */
35   #define P_EXPAND      0x10    /* environment expansion.  NOTE: P_EXPAND can
36                                    never be used for local or hidden options! */
37   #define P_NODEFAULT   0x40    /* don't set to default value */
38 ***************
39 *** 8927,8932 ****
40 --- 8928,8955 ----
41   }
42   
43   /*
44 +  * Free the string for one term option, if it was allocated.
45 +  * Set the string to empty_option and clear allocated flag.
46 +  * "var" points to the option value.
47 +  */
48 +     void
49 + free_one_termoption(var)
50 +     char_u *var;
51 + {
52 +     struct vimoption   *p;
53
54 +     for (p = &options[0]; p->fullname != NULL; p++)
55 +       if (p->var == var)
56 +       {
57 +           if (p->flags & P_ALLOCED)
58 +               free_string_option(*(char_u **)(p->var));
59 +           *(char_u **)(p->var) = empty_option;
60 +           p->flags &= ~P_ALLOCED;
61 +           break;
62 +       }
63 + }
64
65 + /*
66    * Set the terminal option defaults to the current value.
67    * Used after setting the terminal name.
68    */
69 *** ../vim-7.2.237/src/proto/option.pro 2009-02-21 20:27:00.000000000 +0100
70 --- src/proto/option.pro        2009-07-22 12:52:31.000000000 +0200
71 ***************
72 *** 29,34 ****
73 --- 29,35 ----
74   int makefoldset __ARGS((FILE *fd));
75   void clear_termoptions __ARGS((void));
76   void free_termoptions __ARGS((void));
77 + void free_one_termoption __ARGS((char_u *var));
78   void set_term_defaults __ARGS((void));
79   void comp_col __ARGS((void));
80   char_u *get_equalprg __ARGS((void));
81 *** ../vim-7.2.237/src/term.c   2009-06-16 14:31:56.000000000 +0200
82 --- src/term.c  2009-07-22 13:19:59.000000000 +0200
83 ***************
84 *** 2881,2887 ****
85   
86         /* if 'Sb' and 'AB' are not defined, reset "Co" */
87         if (*T_CSB == NUL && *T_CAB == NUL)
88 !           T_CCO = empty_option;
89   
90         /* Set 'weirdinvert' according to value of 't_xs' */
91         p_wiv = (*T_XS != NUL);
92 --- 2881,2887 ----
93   
94         /* if 'Sb' and 'AB' are not defined, reset "Co" */
95         if (*T_CSB == NUL && *T_CAB == NUL)
96 !           free_one_termoption(T_CCO);
97   
98         /* Set 'weirdinvert' according to value of 't_xs' */
99         p_wiv = (*T_XS != NUL);
100 *** ../vim-7.2.237/src/version.c        2009-07-22 13:27:50.000000000 +0200
101 --- src/version.c       2009-07-22 14:25:44.000000000 +0200
102 ***************
103 *** 678,679 ****
104 --- 678,681 ----
105   {   /* Add new patch number below this line */
106 + /**/
107 +     238,
108   /**/
109
110 -- 
111 hundred-and-one symptoms of being an internet addict:
112 95. Only communication in your household is through email.
113
114  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
115 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
116 \\\        download, build and distribute -- http://www.A-A-P.org        ///
117  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.05579 seconds and 3 git commands to generate.