comparison src/misc2.c @ 8212:05b88224cea1 v7.4.1399

commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 23 14:53:34 2016 +0100 patch 7.4.1399 Problem: The MS-DOS code does not build. Solution: Remove the old MS-DOS code.
author Christian Brabandt <cb@256bit.org>
date Tue, 23 Feb 2016 15:00:08 +0100
parents f2286ff0c102
children c66e1f50c142
comparison
equal deleted inserted replaced
8211:6116980b4cfa 8212:05b88224cea1
803 803
804 /* 804 /*
805 * Some memory is reserved for error messages and for being able to 805 * Some memory is reserved for error messages and for being able to
806 * call mf_release_all(), which needs some memory for mf_trans_add(). 806 * call mf_release_all(), which needs some memory for mf_trans_add().
807 */ 807 */
808 #if defined(MSDOS) && !defined(DJGPP) 808 #define KEEP_ROOM (2 * 8192L)
809 # define SMALL_MEM
810 # define KEEP_ROOM 8192L
811 #else
812 # define KEEP_ROOM (2 * 8192L)
813 #endif
814 #define KEEP_ROOM_KB (KEEP_ROOM / 1024L) 809 #define KEEP_ROOM_KB (KEEP_ROOM / 1024L)
815 810
816 /* 811 /*
817 * Note: if unsigned is 16 bits we can only allocate up to 64K with alloc(). 812 * Note: if unsigned is 16 bits we can only allocate up to 64K with alloc().
818 * Use lalloc for larger blocks. 813 * Use lalloc for larger blocks.
890 lalloc(long_u size, int message) 885 lalloc(long_u size, int message)
891 { 886 {
892 char_u *p; /* pointer to new storage space */ 887 char_u *p; /* pointer to new storage space */
893 static int releasing = FALSE; /* don't do mf_release_all() recursive */ 888 static int releasing = FALSE; /* don't do mf_release_all() recursive */
894 int try_again; 889 int try_again;
895 #if defined(HAVE_AVAIL_MEM) && !defined(SMALL_MEM) 890 #if defined(HAVE_AVAIL_MEM)
896 static long_u allocated = 0; /* allocated since last avail check */ 891 static long_u allocated = 0; /* allocated since last avail check */
897 #endif 892 #endif
898 893
899 /* Safety check for allocating zero bytes */ 894 /* Safety check for allocating zero bytes */
900 if (size == 0) 895 if (size == 0)
905 return NULL; 900 return NULL;
906 } 901 }
907 902
908 #ifdef MEM_PROFILE 903 #ifdef MEM_PROFILE
909 mem_pre_alloc_l(&size); 904 mem_pre_alloc_l(&size);
910 #endif
911
912 #if defined(MSDOS) && !defined(DJGPP)
913 if (size >= 0xfff0) /* in MSDOS we can't deal with >64K blocks */
914 p = NULL;
915 else
916 #endif 905 #endif
917 906
918 /* 907 /*
919 * Loop when out of memory: Try to release some memfile blocks and 908 * Loop when out of memory: Try to release some memfile blocks and
920 * if some blocks are released call malloc again. 909 * if some blocks are released call malloc again.
932 { 921 {
933 #ifndef HAVE_AVAIL_MEM 922 #ifndef HAVE_AVAIL_MEM
934 /* 1. No check for available memory: Just return. */ 923 /* 1. No check for available memory: Just return. */
935 goto theend; 924 goto theend;
936 #else 925 #else
937 # ifndef SMALL_MEM
938 /* 2. Slow check for available memory: call mch_avail_mem() after 926 /* 2. Slow check for available memory: call mch_avail_mem() after
939 * allocating (KEEP_ROOM / 2) amount of memory. */ 927 * allocating (KEEP_ROOM / 2) amount of memory. */
940 allocated += size; 928 allocated += size;
941 if (allocated < KEEP_ROOM / 2) 929 if (allocated < KEEP_ROOM / 2)
942 goto theend; 930 goto theend;
943 allocated = 0; 931 allocated = 0;
944 # endif 932
945 /* 3. check for available memory: call mch_avail_mem() */ 933 /* 3. check for available memory: call mch_avail_mem() */
946 if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing) 934 if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing)
947 { 935 {
948 free((char *)p); /* System is low... no go! */ 936 free((char *)p); /* System is low... no go! */
949 p = NULL; 937 p = NULL;
5451 && (ff_file_to_find[2] == NUL 5439 && (ff_file_to_find[2] == NUL
5452 || vim_ispathsep(ff_file_to_find[2]))))); 5440 || vim_ispathsep(ff_file_to_find[2])))));
5453 if (vim_isAbsName(ff_file_to_find) 5441 if (vim_isAbsName(ff_file_to_find)
5454 /* "..", "../path", "." and "./path": don't use the path_option */ 5442 /* "..", "../path", "." and "./path": don't use the path_option */
5455 || rel_to_curdir 5443 || rel_to_curdir
5456 #if defined(MSWIN) || defined(MSDOS) 5444 #if defined(MSWIN)
5457 /* handle "\tmp" as absolute path */ 5445 /* handle "\tmp" as absolute path */
5458 || vim_ispathsep(ff_file_to_find[0]) 5446 || vim_ispathsep(ff_file_to_find[0])
5459 /* handle "c:name" as absolute path */ 5447 /* handle "c:name" as absolute path */
5460 || (ff_file_to_find[0] != NUL && ff_file_to_find[1] == ':') 5448 || (ff_file_to_find[0] != NUL && ff_file_to_find[1] == ':')
5461 #endif 5449 #endif
5505 /* When the file doesn't exist, try adding parts of 5493 /* When the file doesn't exist, try adding parts of
5506 * 'suffixesadd'. */ 5494 * 'suffixesadd'. */
5507 buf = suffixes; 5495 buf = suffixes;
5508 for (;;) 5496 for (;;)
5509 { 5497 {
5510 if ( 5498 if (mch_getperm(NameBuff) >= 0
5511 #ifdef DJGPP
5512 /* "C:" by itself will fail for mch_getperm(),
5513 * assume it's always valid. */
5514 (find_what != FINDFILE_FILE && NameBuff[0] != NUL
5515 && NameBuff[1] == ':'
5516 && NameBuff[2] == NUL) ||
5517 #endif
5518 (mch_getperm(NameBuff) >= 0
5519 && (find_what == FINDFILE_BOTH 5499 && (find_what == FINDFILE_BOTH
5520 || ((find_what == FINDFILE_DIR) 5500 || ((find_what == FINDFILE_DIR)
5521 == mch_isdir(NameBuff))))) 5501 == mch_isdir(NameBuff))))
5522 { 5502 {
5523 file_name = vim_strsave(NameBuff); 5503 file_name = vim_strsave(NameBuff);
5524 goto theend; 5504 goto theend;
5525 } 5505 }
5526 if (*buf == NUL) 5506 if (*buf == NUL)