@@ -1091,10 +1091,6 @@ do_source(
10911091 int save_debug_break_level = debug_break_level ;
10921092 int sid ;
10931093 scriptitem_T * si = NULL ;
1094- # ifdef UNIX
1095- stat_T st ;
1096- int stat_ok ;
1097- # endif
10981094#endif
10991095#ifdef STARTUPTIME
11001096 struct timeval tv_rel ;
@@ -1121,26 +1117,17 @@ do_source(
11211117
11221118#ifdef FEAT_EVAL
11231119 // See if we loaded this script before.
1124- # ifdef UNIX
1125- stat_ok = (mch_stat ((char * )fname_exp , & st ) >= 0 );
1126- # endif
11271120 for (sid = script_items .ga_len ; sid > 0 ; -- sid )
11281121 {
1122+ // We used to check inode here, but that doesn't work:
1123+ // - If a script is edited and written, it may get a different
1124+ // inode number, even though to the user it is the same script.
1125+ // - If a script is deleted and another script is written, with a
1126+ // different name, the inode may be re-used.
11291127 si = & SCRIPT_ITEM (sid );
1130- if (si -> sn_name != NULL )
1131- {
1132- # ifdef UNIX
1133- // Compare dev/ino when possible, it catches symbolic links. Also
1134- // compare file names, the inode may change when the file was
1135- // edited or it may be re-used for another script (esp. in tests).
1136- if ((stat_ok && si -> sn_dev_valid )
1137- && (si -> sn_dev != st .st_dev || si -> sn_ino != st .st_ino ))
1138- continue ;
1139- # endif
1140- if (fnamecmp (si -> sn_name , fname_exp ) == 0 )
1128+ if (si -> sn_name != NULL && fnamecmp (si -> sn_name , fname_exp ) == 0 )
11411129 // Found it!
11421130 break ;
1143- }
11441131 }
11451132 if (sid > 0 && ret_sid != NULL )
11461133 {
@@ -1324,16 +1311,6 @@ do_source(
13241311 si = & SCRIPT_ITEM (current_sctx .sc_sid );
13251312 si -> sn_name = fname_exp ;
13261313 fname_exp = vim_strsave (si -> sn_name ); // used for autocmd
1327- # ifdef UNIX
1328- if (stat_ok )
1329- {
1330- si -> sn_dev_valid = TRUE;
1331- si -> sn_dev = st .st_dev ;
1332- si -> sn_ino = st .st_ino ;
1333- }
1334- else
1335- si -> sn_dev_valid = FALSE;
1336- # endif
13371314 if (ret_sid != NULL )
13381315 * ret_sid = current_sctx .sc_sid ;
13391316 }
0 commit comments