# HG changeset patch # User vimboss # Date 1119654467 0 # Node ID 0f2b5d1b8117021ad3d82ba5cc4986eb7547cd1b # Parent 644578c9e219008b76d208e33e66596f5536c3be updated for version 7.0092 diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2005 Jun 23 +*options.txt* For Vim version 7.0aa. Last change: 2005 Jun 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5673,6 +5673,9 @@ A jump table for the options with a shor region by listing them: "en_us,en_ca" supports both US and Canadian English, but not words specific for Australia, New Zealand or Great Britain. + As a special case the name of a .spl file can be given as-is. This is + mainly for testing purposes. You must make sure the correct encoding + is used, Vim doesn't check it. When 'encoding' is set the word lists are reloaded. Thus it's a good idea to set 'spelllang' after setting 'encoding'. How the related spell files are found is explained here: |spell-load|. diff --git a/runtime/indent/aap.vim b/runtime/indent/aap.vim --- a/runtime/indent/aap.vim +++ b/runtime/indent/aap.vim @@ -1,7 +1,12 @@ " Vim indent file " Language: Aap recipe " Maintainer: Bram Moolenaar -" Last Change: 2003 Sep 08 +" Last Change: 2005 Jun 24 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif " Works mostly like Python. runtime! indent/python.vim diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3020,6 +3020,7 @@ theend: } #if defined(FEAT_EVAL) || defined(PROTO) + /* * ":scriptnames" */ @@ -3068,6 +3069,18 @@ get_scriptname(id) return SCRIPT_ITEM(id).sn_name; } +# if defined(EXITFREE) || defined(PROTO) + void +free_scriptnames() +{ + int i; + + for (i = script_items.ga_len; i > 0; --i) + vim_free(SCRIPT_ITEM(i).sn_name); + ga_clear(&script_items); +} +# endif + #endif #if defined(USE_CR) || defined(PROTO) diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -55,7 +55,6 @@ static int hisnum[HIST_COUNT] = {0, 0, 0 static int hislen = 0; /* actual length of history tables */ static int hist_char2type __ARGS((int c)); -static void init_history __ARGS((void)); static int in_history __ARGS((int, char_u *, int)); # ifdef FEAT_EVAL @@ -4423,7 +4422,7 @@ static char *(history_names[]) = * init_history() - Initialize the command line history. * Also used to re-allocate the history when the size changes. */ - static void + void init_history() { int newlen; /* new length of history table */ diff --git a/src/misc2.c b/src/misc2.c --- a/src/misc2.c +++ b/src/misc2.c @@ -921,6 +921,103 @@ do_outofmem_msg(size) } } +#if defined(EXITFREE) || defined(PROTO) +/* + * Free everything that we allocated. + * Can be used to detect memory leaks, e.g., with ccmalloc. + * Doesn't do nearly all that is required... + */ + void +free_all_mem() +{ + buf_T *buf, *nextbuf; + + ++autocmd_block; /* don't want to trigger autocommands here */ + +# if defined(FEAT_SYN_HL) + /* Free all spell info. */ + spell_free_all(); +# endif + +#if defined(FEAT_USR_CMDS) + /* Clear user commands (before deleting buffers). */ + ex_comclear(NULL); +#endif + +# ifdef FEAT_MENU + /* Clear menus. */ + do_cmdline_cmd((char_u *)"aunmenu *"); +# endif + + /* Clear mappings and abbreviations. */ + do_cmdline_cmd((char_u *)"mapclear"); + do_cmdline_cmd((char_u *)"mapclear!"); + do_cmdline_cmd((char_u *)"abclear"); + + /* Obviously named calls. */ +# if defined(FEAT_EVAL) + free_scriptnames(); + free_all_functions(); +# endif +# if defined(FEAT_AUTOCMD) + free_all_autocmds(); +# endif + clear_termcodes(); + + /* Clear cmdline history. */ + p_hi = 0; + init_history(); + + /* Free all buffers. */ + for (buf = firstbuf; buf != NULL; ) + { + nextbuf = buf->b_next; + close_buffer(NULL, buf, DOBUF_WIPE); + if (buf_valid(buf)) + buf = nextbuf; /* didn't work, try next one */ + else + buf = firstbuf; + } + +#if defined(FEAT_WINDOWS) + /* Destroy all windows. */ + win_free_all(); +#endif + + /* Clear registers. */ + clear_registers(); + ResetRedobuff(); + ResetRedobuff(); + + /* highlight info */ + free_highlight(); + +# ifdef UNIX + /* Machine-specific free. */ + mch_free_mem(); +# endif + + /* message history */ + for (;;) + if (delete_first_msg() == FAIL) + break; + +# ifdef FEAT_EVAL + eval_clear(); +# endif + + /* screenlines (can't display anything now!) */ + free_screenlines(); + +#if defined(USE_XSMP) + xsmp_close(); +#endif + + vim_free(IObuff); + vim_free(NameBuff); +} +#endif + /* * copy a string into newly allocated memory */ diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -2602,6 +2602,21 @@ init_yank() y_regs[i].y_array = NULL; } +#if defined(EXITFREE) || defined(PROTO) + void +clear_registers() +{ + int i; + + for (i = 0; i < NUM_REGISTERS; ++i) + { + y_current = &y_regs[i]; + if (y_current->y_array != NULL) + free_yank_all(); + } +} +#endif + /* * Free "n" lines from the current yank register. * Called for normal freeing and in case of error. diff --git a/src/proto/eval.pro b/src/proto/eval.pro --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -1,5 +1,6 @@ /* eval.c */ void eval_init __ARGS((void)); +void eval_clear __ARGS((void)); char_u *func_name __ARGS((void *cookie)); linenr_T *func_breakpoint __ARGS((void *cookie)); int *func_dbg_tick __ARGS((void *cookie)); @@ -60,6 +61,7 @@ void ex_echo __ARGS((exarg_T *eap)); void ex_echohl __ARGS((exarg_T *eap)); void ex_execute __ARGS((exarg_T *eap)); void ex_function __ARGS((exarg_T *eap)); +void free_all_functions __ARGS((void)); void func_dump_profile __ARGS((FILE *fd)); char_u *get_user_func_name __ARGS((expand_T *xp, int idx)); void ex_delfunction __ARGS((exarg_T *eap)); diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro --- a/src/proto/fileio.pro +++ b/src/proto/fileio.pro @@ -23,6 +23,7 @@ char_u *vim_tempname __ARGS((int extra_c void forward_slash __ARGS((char_u *fname)); void aubuflocal_remove __ARGS((buf_T *buf)); void do_augroup __ARGS((char_u *arg, int del_group)); +void free_all_autocmds __ARGS((void)); int check_ei __ARGS((void)); char_u *au_event_disable __ARGS((char *what)); void au_event_restore __ARGS((char_u *old_ei)); diff --git a/src/proto/hashtable.pro b/src/proto/hashtable.pro --- a/src/proto/hashtable.pro +++ b/src/proto/hashtable.pro @@ -8,7 +8,6 @@ int hash_add __ARGS((hashtab_T *ht, char int hash_add_item __ARGS((hashtab_T *ht, hashitem_T *hi, char_u *key, hash_T hash)); void hash_remove __ARGS((hashtab_T *ht, hashitem_T *hi)); void hash_lock __ARGS((hashtab_T *ht)); -void hash_lock_size __ARGS((hashtab_T *ht, int size)); void hash_unlock __ARGS((hashtab_T *ht)); hash_T hash_hash __ARGS((char_u *key)); /* vim: set ft=c : */ diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro --- a/src/proto/os_unix.pro +++ b/src/proto/os_unix.pro @@ -41,6 +41,7 @@ int mch_isdir __ARGS((char_u *name)); int mch_can_exe __ARGS((char_u *name)); int mch_nodetype __ARGS((char_u *name)); void mch_early_init __ARGS((void)); +void mch_free_mem __ARGS((void)); void mch_exit __ARGS((int r)); void mch_settmode __ARGS((int tmode)); void get_stty __ARGS((void)); diff --git a/src/proto/spell.pro b/src/proto/spell.pro --- a/src/proto/spell.pro +++ b/src/proto/spell.pro @@ -3,6 +3,7 @@ int spell_check __ARGS((win_T *wp, char_ int spell_move_to __ARGS((int dir, int allwords, int curline)); void spell_cat_line __ARGS((char_u *buf, char_u *line, int maxlen)); char_u *did_set_spelllang __ARGS((buf_T *buf)); +void spell_free_all __ARGS((void)); void spell_reload __ARGS((void)); void put_bytes __ARGS((FILE *fd, long_u nr, int len)); void ex_mkspell __ARGS((exarg_T *eap)); diff --git a/src/proto/window.pro b/src/proto/window.pro --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -8,6 +8,7 @@ void win_move_after __ARGS((win_T *win1, void win_equal __ARGS((win_T *next_curwin, int current, int dir)); void close_windows __ARGS((buf_T *buf)); void win_close __ARGS((win_T *win, int free_buf)); +void win_free_all __ARGS((void)); void close_others __ARGS((int message, int forceit)); void win_init __ARGS((win_T *wp)); void win_alloc_first __ARGS((void)); diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -6798,16 +6798,8 @@ screenalloc(clear) current_ScreenLine = new_ScreenLines + Rows * Columns; } - vim_free(ScreenLines); -#ifdef FEAT_MBYTE - vim_free(ScreenLinesUC); - vim_free(ScreenLinesC1); - vim_free(ScreenLinesC2); - vim_free(ScreenLines2); -#endif - vim_free(ScreenAttrs); - vim_free(LineOffset); - vim_free(LineWraps); + free_screenlines(); + ScreenLines = new_ScreenLines; #ifdef FEAT_MBYTE ScreenLinesUC = new_ScreenLinesUC; @@ -6855,6 +6847,21 @@ screenalloc(clear) } void +free_screenlines() +{ + vim_free(ScreenLines); +#ifdef FEAT_MBYTE + vim_free(ScreenLinesUC); + vim_free(ScreenLinesC1); + vim_free(ScreenLinesC2); + vim_free(ScreenLines2); +#endif + vim_free(ScreenAttrs); + vim_free(LineOffset); + vim_free(LineWraps); +} + + void screenclear() { check_for_delay(FALSE); diff --git a/src/syntax.c b/src/syntax.c --- a/src/syntax.c +++ b/src/syntax.c @@ -7067,6 +7067,18 @@ do_highlight(line, forceit, init) need_highlight_changed = TRUE; } +#if defined(EXITFREE) || defined(PROTO) + void +free_highlight() +{ + int i; + + for (i = 0; i < highlight_ga.ga_len; ++i) + highlight_clear(i); + ga_clear(&highlight_ga); +} +#endif + /* * Reset the cterm colors to what they were before Vim was started, if * possible. Otherwise reset them to zero. diff --git a/src/undo.c b/src/undo.c --- a/src/undo.c +++ b/src/undo.c @@ -949,7 +949,7 @@ u_saveline(lnum) { if (lnum == curbuf->b_u_line_lnum) /* line is already saved */ return; - if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) /* should never happen */ + if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) /* should never happen */ return; u_clearline(); curbuf->b_u_line_lnum = lnum; diff --git a/src/version.h b/src/version.h --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 23)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 23, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 24)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 24, compiled "