Hi Bram and list,

Title is as it is.

- Compiler optimizations will be a bit smarter.
- Execution speed will be a bit faster.
- Compiler us warn the code assignment wrong.

- None. (maybe)

I made a patch for proposal.
How about this?

When it's Okay, I'll continue with the remaining of the work.
Best regards,
Hirohito Higashi (a.k.a. h_east)

You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/buffer.c b/src/buffer.c
index b013295..b2fe5fa 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -377,7 +377,7 @@ set_bufref(bufref_T *bufref, buf_T *buf)
  * Only goes through the buffer list if buf_free_count changed.
-bufref_valid(bufref_T *bufref)
+bufref_valid(const bufref_T *bufref)
     return bufref->br_buf_free_count == buf_free_count
 					   ? TRUE : buf_valid(bufref->br_buf);
@@ -388,7 +388,7 @@ bufref_valid(bufref_T *bufref)
  * This can be slow if there are many buffers, prefer using bufref_valid().
-buf_valid(buf_T *buf)
+buf_valid(const buf_T *buf)
     buf_T	*bp;
diff --git a/src/eval.c b/src/eval.c
index 6873b97..5ec9733 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -6696,7 +6696,7 @@ v_throwpoint(char_u *oldval)
  * Must always be called in pairs!
     char_u *
-set_cmdarg(exarg_T *eap, char_u *oldarg)
+set_cmdarg(const exarg_T *eap, char_u *oldarg)
     char_u	*oldval;
     char_u	*newval;
diff --git a/src/fileio.c b/src/fileio.c
index ea1f338..44f381d 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7780,7 +7780,7 @@ static char_u *find_end_event(char_u *arg, int have_group);
 static int event_ignored(event_T event);
 static int au_get_grouparg(char_u **argp);
 static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group);
-static int apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap);
+static int apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, int force, int group, const buf_T *buf, const exarg_T *eap);
 static void auto_next_pat(AutoPatCmd *apc, int stop_at_last);
 #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN)
 static int match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs);
@@ -7949,7 +7949,7 @@ au_cleanup(void)
  * autocmds.
-aubuflocal_remove(buf_T *buf)
+aubuflocal_remove(const buf_T *buf)
     AutoPat	*ap;
     event_T	event;
@@ -9098,7 +9098,7 @@ apply_autocmds(
     char_u	*fname,	    /* NULL or empty means use actual file name */
     char_u	*fname_io,  /* fname to use for <afile> on cmdline */
     int		force,	    /* when TRUE, ignore autocmd_busy */
-    buf_T	*buf)	    /* buffer for <abuf> */
+    const buf_T	*buf)	    /* buffer for <abuf> */
     return apply_autocmds_group(event, fname, fname_io, force,
 						      AUGROUP_ALL, buf, NULL);
@@ -9263,8 +9263,8 @@ apply_autocmds_group(
 			       use fname */
     int		force,	    /* when TRUE, ignore autocmd_busy */
     int		group,	    /* group ID, or AUGROUP_ALL */
-    buf_T	*buf,	    /* buffer for <abuf> */
-    exarg_T	*eap)	    /* command arguments */
+    const buf_T	*buf,	    /* buffer for <abuf> */
+    const exarg_T *eap)	    /* command arguments */
     char_u	*sfname = NULL;	/* short file name */
     char_u	*tail;
diff --git a/src/fold.c b/src/fold.c
index d3635a6..42d92ab 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -100,7 +100,7 @@ static int foldendmarkerlen;
  * Copy that folding state from window "wp_from" to window "wp_to".
-copyFoldingState(win_T *wp_from, win_T *wp_to)
+copyFoldingState(const win_T *wp_from, win_T *wp_to)
     wp_to->w_fold_manual = wp_from->w_fold_manual;
     wp_to->w_foldinvalid = wp_from->w_foldinvalid;
@@ -1083,17 +1083,17 @@ foldAdjustCursor(void)
  * Return FAIL if the operation cannot be completed, otherwise OK.
-cloneFoldGrowArray(garray_T *from, garray_T *to)
+cloneFoldGrowArray(const garray_T *from, garray_T *to)
     int		i;
-    fold_T	*from_p;
+    const fold_T *from_p;
     fold_T	*to_p;
     ga_init2(to, from->ga_itemsize, from->ga_growsize);
     if (from->ga_len == 0 || ga_grow(to, from->ga_len) == FAIL)
-    from_p = (fold_T *)from->ga_data;
+    from_p = (const fold_T *)from->ga_data;
     to_p = (fold_T *)to->ga_data;
     for (i = 0; i < from->ga_len; i++)
diff --git a/src/mark.c b/src/mark.c
index 0627a7c..04e7abf 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -1315,7 +1315,7 @@ cleanup_jumplist(void)
  * Copy the jumplist from window "from" to window "to".
-copy_jumplist(win_T *from, win_T *to)
+copy_jumplist(const win_T *from, win_T *to)
     int		i;
diff --git a/src/option.c b/src/option.c
index 2d5f3b8..fe0113e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -10489,7 +10489,7 @@ get_equalprg(void)
  * Used when splitting a window.
-win_copy_options(win_T *wp_from, win_T *wp_to)
+win_copy_options(const win_T *wp_from, win_T *wp_to)
     copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
     copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
@@ -10512,7 +10512,7 @@ win_copy_options(win_T *wp_from, win_T *wp_to)
  * The 'previewwindow' option is reset, there can be only one preview window.
-copy_winopt(winopt_T *from, winopt_T *to)
+copy_winopt(const winopt_T *from, winopt_T *to)
     to->wo_arab = from->wo_arab;
diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro
index 183f79a..4ebf662 100644
--- a/src/proto/buffer.pro
+++ b/src/proto/buffer.pro
@@ -1,8 +1,8 @@
 /* buffer.c */
 int open_buffer(int read_stdin, exarg_T *eap, int flags);
 void set_bufref(bufref_T *bufref, buf_T *buf);
-int bufref_valid(bufref_T *bufref);
-int buf_valid(buf_T *buf);
+int bufref_valid(const bufref_T *bufref);
+int buf_valid(const buf_T *buf);
 void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last);
 void buf_clear_file(buf_T *buf);
 void buf_freeall(buf_T *buf, int flags);
diff --git a/src/proto/eval.pro b/src/proto/eval.pro
index edca43e..30f6eb1 100644
--- a/src/proto/eval.pro
+++ b/src/proto/eval.pro
@@ -72,7 +72,7 @@ void set_vim_var_dict(int idx, dict_T *val);
 void set_reg_var(int c);
 char_u *v_exception(char_u *oldval);
 char_u *v_throwpoint(char_u *oldval);
-char_u *set_cmdarg(exarg_T *eap, char_u *oldarg);
+char_u *set_cmdarg(const exarg_T *eap, char_u *oldarg);
 int get_var_tv(char_u *name, int len, typval_T *rettv, dictitem_T **dip, int verbose, int no_autoload);
 int handle_subscript(char_u **arg, typval_T *rettv, int evaluate, int verbose);
 typval_T *alloc_tv(void);
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
index 30582d4..99e7d06 100644
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -27,7 +27,7 @@ int delete_recursive(char_u *name);
 void vim_deltempdir(void);
 char_u *vim_tempname(int extra_char, int keep);
 void forward_slash(char_u *fname);
-void aubuflocal_remove(buf_T *buf);
+void aubuflocal_remove(const buf_T *buf);
 int au_has_group(char_u *name);
 void do_augroup(char_u *arg, int del_group);
 void free_all_autocmds(void);
@@ -40,7 +40,7 @@ void ex_doautoall(exarg_T *eap);
 int check_nomodeline(char_u **argp);
 void aucmd_prepbuf(aco_save_T *aco, buf_T *buf);
 void aucmd_restbuf(aco_save_T *aco);
-int apply_autocmds(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf);
+int apply_autocmds(event_T event, char_u *fname, char_u *fname_io, int force, const buf_T *buf);
 int apply_autocmds_retval(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, int *retval);
 int has_cursorhold(void);
 int trigger_cursorhold(void);
diff --git a/src/proto/fold.pro b/src/proto/fold.pro
index dce1803..dac1131 100644
--- a/src/proto/fold.pro
+++ b/src/proto/fold.pro
@@ -1,5 +1,5 @@
 /* fold.c */
-void copyFoldingState(win_T *wp_from, win_T *wp_to);
+void copyFoldingState(const win_T *wp_from, win_T *wp_to);
 int hasAnyFolding(win_T *win);
 int hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp);
 int hasFoldingWin(win_T *win, linenr_T lnum, linenr_T *firstp, linenr_T *lastp, int cache, foldinfo_T *infop);
@@ -31,7 +31,7 @@ void foldInitWin(win_T *new_win);
 int find_wl_entry(win_T *win, linenr_T lnum);
 void foldAdjustVisual(void);
 void foldAdjustCursor(void);
-void cloneFoldGrowArray(garray_T *from, garray_T *to);
+void cloneFoldGrowArray(const garray_T *from, garray_T *to);
 void deleteFoldRecurse(garray_T *gap);
 void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after);
 int getDeepestNesting(void);
diff --git a/src/proto/mark.pro b/src/proto/mark.pro
index 90be1a5..84b5dbc 100644
--- a/src/proto/mark.pro
+++ b/src/proto/mark.pro
@@ -20,7 +20,7 @@ void ex_clearjumps(exarg_T *eap);
 void ex_changes(exarg_T *eap);
 void mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after);
 void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount);
-void copy_jumplist(win_T *from, win_T *to);
+void copy_jumplist(const win_T *from, win_T *to);
 void free_jumplist(win_T *wp);
 void set_last_cursor(win_T *win);
 void free_all_marks(void);
diff --git a/src/proto/option.pro b/src/proto/option.pro
index 8c9bde5..e39bf1d 100644
--- a/src/proto/option.pro
+++ b/src/proto/option.pro
@@ -37,8 +37,8 @@ void set_term_defaults(void);
 void comp_col(void);
 void unset_global_local_option(char_u *name, void *from);
 char_u *get_equalprg(void);
-void win_copy_options(win_T *wp_from, win_T *wp_to);
-void copy_winopt(winopt_T *from, winopt_T *to);
+void win_copy_options(const win_T *wp_from, win_T *wp_to);
+void copy_winopt(const winopt_T *from, winopt_T *to);
 void check_win_options(win_T *win);
 void clear_winopt(winopt_T *wop);
 void buf_copy_options(buf_T *buf, int flags);
diff --git a/src/proto/quickfix.pro b/src/proto/quickfix.pro
index d48eb25..42deb56 100644
--- a/src/proto/quickfix.pro
+++ b/src/proto/quickfix.pro
@@ -1,7 +1,7 @@
 /* quickfix.c */
 int qf_init(win_T *wp, char_u *efile, char_u *errorformat, int newlist, char_u *qf_title);
 void qf_free_all(win_T *wp);
-void copy_loclist(win_T *from, win_T *to);
+void copy_loclist(const win_T *from, win_T *to);
 void qf_jump(qf_info_T *qi, int dir, int errornr, int forceit);
 void qf_list(exarg_T *eap);
 void qf_age(exarg_T *eap);
diff --git a/src/proto/window.pro b/src/proto/window.pro
index 8b649db..f1bf364 100644
--- a/src/proto/window.pro
+++ b/src/proto/window.pro
@@ -3,13 +3,13 @@ void do_window(int nchar, long Prenum, int xchar);
 void get_wincmd_addr_type(char_u *arg, exarg_T *eap);
 int win_split(int size, int flags);
 int win_split_ins(int size, int flags, win_T *new_wp, int dir);
-int win_valid(win_T *win);
-int win_valid_any_tab(win_T *win);
+int win_valid(const win_T *win);
+int win_valid_any_tab(const win_T *win);
 int win_count(void);
 int make_windows(int count, int vertical);
 void win_move_after(win_T *win1, win_T *win2);
 void win_equal(win_T *next_curwin, int current, int dir);
-void close_windows(buf_T *buf, int keep_curwin);
+void close_windows(const buf_T *buf, int keep_curwin);
 int one_window(void);
 int win_close(win_T *win, int free_buf);
 void win_close_othertab(win_T *win, int free_buf, tabpage_T *tp);
diff --git a/src/quickfix.c b/src/quickfix.c
index 2f5256b..41353f7 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1498,7 +1498,7 @@ ll_get_or_alloc_list(win_T *wp)
  * Copy the location list from window "from" to window "to".
-copy_loclist(win_T *from, win_T *to)
+copy_loclist(const win_T *from, win_T *to)
     qf_info_T	*qi;
     int		idx;
diff --git a/src/window.c b/src/window.c
index f61a83b..c16fac6 100644
--- a/src/window.c
+++ b/src/window.c
@@ -12,29 +12,29 @@
 static int path_is_url(char_u *p);
 #if defined(FEAT_WINDOWS) || defined(PROTO)
 static void cmd_with_count(char *cmd, char_u *bufp, size_t bufsize, long Prenum);
-static void win_init(win_T *newp, win_T *oldp, int flags);
-static void win_init_some(win_T *newp, win_T *oldp);
+static void win_init(win_T *newp, const win_T *oldp, int flags);
+static void win_init_some(win_T *newp, const win_T *oldp);
 static void frame_comp_pos(frame_T *topfrp, int *row, int *col);
 static void frame_setheight(frame_T *curfrp, int height);
 static void frame_setwidth(frame_T *curfrp, int width);
 static void win_exchange(long);
 static void win_rotate(int, int);
 static void win_totop(int size, int flags);
-static void win_equal_rec(win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height);
+static void win_equal_rec(const win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height);
 static int last_window(void);
 static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_curtab);
 static win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp);
-static frame_T *win_altframe(win_T *win, tabpage_T *tp);
+static frame_T *win_altframe(const win_T *win, tabpage_T *tp);
 static tabpage_T *alt_tabpage(void);
 static win_T *frame2win(frame_T *frp);
-static int frame_has_win(frame_T *frp, win_T *wp);
+static int frame_has_win(const frame_T *frp, const win_T *wp);
 static void frame_new_height(frame_T *topfrp, int height, int topfirst, int wfh);
-static int frame_fixed_height(frame_T *frp);
-static int frame_fixed_width(frame_T *frp);
+static int frame_fixed_height(const frame_T *frp);
+static int frame_fixed_width(const frame_T *frp);
 static void frame_add_statusline(frame_T *frp);
 static void frame_new_width(frame_T *topfrp, int width, int leftfirst, int wfw);
 static void frame_add_vsep(frame_T *frp);
-static int frame_minwidth(frame_T *topfrp, win_T *next_curwin);
+static int frame_minwidth(const frame_T *topfrp, const win_T *next_curwin);
 static void frame_fix_width(win_T *wp);
 static int win_alloc_firstwin(win_T *oldwin);
@@ -44,7 +44,7 @@ static tabpage_T *alloc_tabpage(void);
 static int leave_tabpage(buf_T *new_curbuf, int trigger_leave_autocmds);
 static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_autocmds, int trigger_leave_autocmds);
 static void frame_fix_height(win_T *wp);
-static int frame_minheight(frame_T *topfrp, win_T *next_curwin);
+static int frame_minheight(const frame_T *topfrp, const win_T *next_curwin);
 static void win_enter_ext(win_T *wp, int undo_sync, int no_curwin, int trigger_new_autocmds, int trigger_enter_autocmds, int trigger_leave_autocmds);
 static void win_free(win_T *wp, tabpage_T *tp);
 static void frame_append(frame_T *after, frame_T *frp);
@@ -1277,7 +1277,7 @@ win_split_ins(
  * being copied.
     static void
-win_init(win_T *newp, win_T *oldp, int flags UNUSED)
+win_init(win_T *newp, const win_T *oldp, int flags UNUSED)
     int		i;
@@ -1343,7 +1343,7 @@ win_init(win_T *newp, win_T *oldp, int flags UNUSED)
  * Only the essential things are copied.
     static void
-win_init_some(win_T *newp, win_T *oldp)
+win_init_some(win_T *newp, const win_T *oldp)
     /* Use the same argument list. */
     newp->w_alist = oldp->w_alist;
@@ -1361,7 +1361,7 @@ win_init_some(win_T *newp, win_T *oldp)
  * Check if "win" is a pointer to an existing window in the current tab page.
-win_valid(win_T *win)
+win_valid(const win_T *win)
     win_T	*wp;
@@ -1377,7 +1377,7 @@ win_valid(win_T *win)
  * Check if "win" is a pointer to an existing window in any tab page.
-win_valid_any_tab(win_T *win)
+win_valid_any_tab(const win_T *win)
     win_T	*wp;
     tabpage_T	*tp;
@@ -1788,7 +1788,7 @@ win_equal(
     static void
-    win_T	*next_curwin,	/* pointer to current window to be or NULL */
+    const win_T *next_curwin,	/* pointer to current window to be or NULL */
     int		current,	/* do only frame with current window */
     frame_T	*topfr,		/* frame to set size off */
     int		dir,		/* 'v', 'h' or 'b', see win_equal() */
@@ -2111,7 +2111,7 @@ win_equal_rec(
-    buf_T	*buf,
+    const buf_T *buf,
     int		keep_curwin)	    /* don't close "curwin" */
     win_T	*wp;
@@ -2774,7 +2774,7 @@ winframe_remove(
     static frame_T *
-    win_T	*win,
+    const win_T	*win,
     tabpage_T	*tp)		/* tab page "win" is in, NULL for current */
     frame_T	*frp;
@@ -2827,9 +2827,9 @@ frame2win(frame_T *frp)
  * Return TRUE if frame "frp" contains window "wp".
     static int
-frame_has_win(frame_T *frp, win_T *wp)
+frame_has_win(const frame_T *frp, const win_T *wp)
-    frame_T	*p;
+    const frame_T *p;
     if (frp->fr_layout == FR_LEAF)
 	return frp->fr_win == wp;
@@ -2954,7 +2954,7 @@ frame_new_height(
  * the 'winfixheight' option.
     static int
-frame_fixed_height(frame_T *frp)
+frame_fixed_height(const frame_T *frp)
     /* frame with one window: fixed height if 'winfixheight' set. */
     if (frp->fr_win != NULL)
@@ -2983,7 +2983,7 @@ frame_fixed_height(frame_T *frp)
  * the 'winfixwidth' option.
     static int
-frame_fixed_width(frame_T *frp)
+frame_fixed_width(const frame_T *frp)
     /* frame with one window: fixed width if 'winfixwidth' set. */
     if (frp->fr_win != NULL)
@@ -3217,9 +3217,9 @@ frame_fix_height(win_T *wp)
  * window.
     static int
-frame_minheight(frame_T *topfrp, win_T *next_curwin)
+frame_minheight(const frame_T *topfrp, const win_T *next_curwin)
-    frame_T	*frp;
+    const frame_T *frp;
     int		m;
     int		n;
@@ -3266,10 +3266,10 @@ frame_minheight(frame_T *topfrp, win_T *next_curwin)
     static int
-    frame_T	*topfrp,
-    win_T	*next_curwin)	/* use p_wh and p_wiw for next_curwin */
+    const frame_T *topfrp,
+    const win_T *next_curwin)	/* use p_wh and p_wiw for next_curwin */
-    frame_T	*frp;
+    const frame_T *frp;
     int		m, n;
     if (topfrp->fr_win != NULL)

Raspunde prin e-mail lui