comparison src/misc2.c @ 356:0f2b5d1b8117

updated for version 7.0092
author vimboss
date Fri, 24 Jun 2005 23:07:47 +0000
parents d5e895294dce
children 6c62b9b939bd
comparison
equal deleted inserted replaced
355:644578c9e219 356:0f2b5d1b8117
918 emsg_silent = 0; 918 emsg_silent = 0;
919 EMSGN(_("E342: Out of memory! (allocating %lu bytes)"), size); 919 EMSGN(_("E342: Out of memory! (allocating %lu bytes)"), size);
920 did_outofmem_msg = TRUE; 920 did_outofmem_msg = TRUE;
921 } 921 }
922 } 922 }
923
924 #if defined(EXITFREE) || defined(PROTO)
925 /*
926 * Free everything that we allocated.
927 * Can be used to detect memory leaks, e.g., with ccmalloc.
928 * Doesn't do nearly all that is required...
929 */
930 void
931 free_all_mem()
932 {
933 buf_T *buf, *nextbuf;
934
935 ++autocmd_block; /* don't want to trigger autocommands here */
936
937 # if defined(FEAT_SYN_HL)
938 /* Free all spell info. */
939 spell_free_all();
940 # endif
941
942 #if defined(FEAT_USR_CMDS)
943 /* Clear user commands (before deleting buffers). */
944 ex_comclear(NULL);
945 #endif
946
947 # ifdef FEAT_MENU
948 /* Clear menus. */
949 do_cmdline_cmd((char_u *)"aunmenu *");
950 # endif
951
952 /* Clear mappings and abbreviations. */
953 do_cmdline_cmd((char_u *)"mapclear");
954 do_cmdline_cmd((char_u *)"mapclear!");
955 do_cmdline_cmd((char_u *)"abclear");
956
957 /* Obviously named calls. */
958 # if defined(FEAT_EVAL)
959 free_scriptnames();
960 free_all_functions();
961 # endif
962 # if defined(FEAT_AUTOCMD)
963 free_all_autocmds();
964 # endif
965 clear_termcodes();
966
967 /* Clear cmdline history. */
968 p_hi = 0;
969 init_history();
970
971 /* Free all buffers. */
972 for (buf = firstbuf; buf != NULL; )
973 {
974 nextbuf = buf->b_next;
975 close_buffer(NULL, buf, DOBUF_WIPE);
976 if (buf_valid(buf))
977 buf = nextbuf; /* didn't work, try next one */
978 else
979 buf = firstbuf;
980 }
981
982 #if defined(FEAT_WINDOWS)
983 /* Destroy all windows. */
984 win_free_all();
985 #endif
986
987 /* Clear registers. */
988 clear_registers();
989 ResetRedobuff();
990 ResetRedobuff();
991
992 /* highlight info */
993 free_highlight();
994
995 # ifdef UNIX
996 /* Machine-specific free. */
997 mch_free_mem();
998 # endif
999
1000 /* message history */
1001 for (;;)
1002 if (delete_first_msg() == FAIL)
1003 break;
1004
1005 # ifdef FEAT_EVAL
1006 eval_clear();
1007 # endif
1008
1009 /* screenlines (can't display anything now!) */
1010 free_screenlines();
1011
1012 #if defined(USE_XSMP)
1013 xsmp_close();
1014 #endif
1015
1016 vim_free(IObuff);
1017 vim_free(NameBuff);
1018 }
1019 #endif
923 1020
924 /* 1021 /*
925 * copy a string into newly allocated memory 1022 * copy a string into newly allocated memory
926 */ 1023 */
927 char_u * 1024 char_u *