4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Possible crash when using C++ indenting. (Chris Monson)
12 Solution: Keep the line pointer to the line to compare with. Avoid going
17 *** ../vim-7.1.049/src/misc1.c Tue Jul 24 15:25:27 2007
18 --- src/misc1.c Fri Aug 3 21:07:17 2007
21 static int cin_iswhileofdo __ARGS((char_u *, linenr_T, int));
22 static int cin_iswhileofdo_end __ARGS((int terminated, int ind_maxparen, int ind_maxcomment));
23 static int cin_isbreak __ARGS((char_u *));
24 ! static int cin_is_cpp_baseclass __ARGS((char_u *line, colnr_T *col));
25 static int get_baseclass_amount __ARGS((int col, int ind_maxparen, int ind_maxcomment, int ind_cpp_baseclass));
26 static int cin_ends_in __ARGS((char_u *, char_u *, char_u *));
27 static int cin_skip2pos __ARGS((pos_T *trypos));
29 static int cin_iswhileofdo __ARGS((char_u *, linenr_T, int));
30 static int cin_iswhileofdo_end __ARGS((int terminated, int ind_maxparen, int ind_maxcomment));
31 static int cin_isbreak __ARGS((char_u *));
32 ! static int cin_is_cpp_baseclass __ARGS((colnr_T *col));
33 static int get_baseclass_amount __ARGS((int col, int ind_maxparen, int ind_maxcomment, int ind_cpp_baseclass));
34 static int cin_ends_in __ARGS((char_u *, char_u *, char_u *));
35 static int cin_skip2pos __ARGS((pos_T *trypos));
38 * This is a lot of guessing. Watch out for "cond ? func() : foo".
41 ! cin_is_cpp_baseclass(line, col)
43 colnr_T *col; /* return: column to align with */
46 int class_or_struct, lookfor_ctor_init, cpp_base_class;
47 linenr_T lnum = curwin->w_cursor.lnum;
52 * This is a lot of guessing. Watch out for "cond ? func() : foo".
55 ! cin_is_cpp_baseclass(col)
56 colnr_T *col; /* return: column to align with */
59 int class_or_struct, lookfor_ctor_init, cpp_base_class;
60 linenr_T lnum = curwin->w_cursor.lnum;
61 + char_u *line = ml_get_curline();
70 ! s = skipwhite(ml_get(lnum - 1));
71 if (*s == '#' || *s == NUL)
78 ! line = ml_get(lnum - 1);
79 ! s = skipwhite(line);
80 if (*s == '#' || *s == NUL)
88 ! s = cin_skipcomment(ml_get(lnum));
96 ! line = ml_get(lnum);
97 ! s = cin_skipcomment(line);
103 if (lnum == curwin->w_cursor.lnum)
105 /* Continue in the cursor line. */
106 ! s = cin_skipcomment(ml_get(++lnum));
111 if (lnum == curwin->w_cursor.lnum)
113 /* Continue in the cursor line. */
114 ! line = ml_get(++lnum);
115 ! s = cin_skipcomment(line);
124 if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0)
126 ! n = cin_is_cpp_baseclass(l, &col);
127 l = ml_get_curline();
132 if (lookfor != LOOKFOR_TERM && ind_cpp_baseclass > 0)
134 ! n = cin_is_cpp_baseclass(&col);
135 l = ml_get_curline();
141 if (ind_cpp_baseclass != 0 && theline[0] != '{')
143 ! n = cin_is_cpp_baseclass(l, &col);
144 l = ml_get_curline();
149 if (ind_cpp_baseclass != 0 && theline[0] != '{')
151 ! n = cin_is_cpp_baseclass(&col);
152 l = ml_get_curline();
155 *** ../vim-7.1.049/src/version.c Fri Aug 3 22:01:35 2007
156 --- src/version.c Sat Aug 4 12:11:51 2007
160 { /* Add new patch number below this line */
166 From "know your smileys":
167 |-P Reaction to unusually ugly C code
169 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
170 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
171 \\\ download, build and distribute -- http://www.A-A-P.org ///
172 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///