diff --git a/src/diff.c b/src/diff.c index 392fef00c9..5a21df2d0c 100644 --- a/src/diff.c +++ b/src/diff.c @@ -728,10 +728,10 @@ void ex_diffupdate(exarg_T *eap) } fclose(fd); } - mch_remove(tmp_diff); - mch_remove(tmp_new); + os_remove((char *)tmp_diff); + os_remove((char *)tmp_new); } - mch_remove(tmp_orig); + os_remove((char *)tmp_orig); } // When using 'diffexpr' break here. @@ -790,10 +790,10 @@ void ex_diffupdate(exarg_T *eap) // Read the diff output and add each entry to the diff list. diff_read(idx_orig, idx_new, tmp_diff); - mch_remove(tmp_diff); - mch_remove(tmp_new); + os_remove((char *)tmp_diff); + os_remove((char *)tmp_new); } - mch_remove(tmp_orig); + os_remove((char *)tmp_orig); // force updating cursor position on screen curwin->w_valid_cursor.lnum = 0; @@ -959,10 +959,10 @@ void ex_diffpatch(exarg_T *eap) // Delete any .orig or .rej file created. STRCPY(buf, tmp_new); STRCAT(buf, ".orig"); - mch_remove(buf); + os_remove((char *)buf); STRCPY(buf, tmp_new); STRCAT(buf, ".rej"); - mch_remove(buf); + os_remove((char *)buf); // Only continue if the output file was created. if ((mch_stat((char *)tmp_new, &st) < 0) || (st.st_size == 0)) { @@ -1008,12 +1008,12 @@ void ex_diffpatch(exarg_T *eap) theend: if (tmp_orig != NULL) { - mch_remove(tmp_orig); + os_remove((char *)tmp_orig); } vim_free(tmp_orig); if (tmp_new != NULL) { - mch_remove(tmp_new); + os_remove((char *)tmp_new); } vim_free(tmp_new); vim_free(newname); diff --git a/src/eval.c b/src/eval.c index e1f7de3707..0c6f2911b3 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1187,7 +1187,7 @@ int eval_printexpr(char_u *fname, char_u *args) set_vim_var_string(VV_CMDARG, NULL, -1); if (err) { - mch_remove(fname); + os_remove((char *)fname); return FAIL; } return OK; @@ -8413,7 +8413,7 @@ static void f_delete(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) rettv->vval.v_number = -1; else - rettv->vval.v_number = mch_remove(get_tv_string(&argvars[0])); + rettv->vval.v_number = os_remove((char *)get_tv_string(&argvars[0])); } /* @@ -14702,7 +14702,7 @@ static void f_system(typval_T *argvars, typval_T *rettv) done: if (infile != NULL) { - mch_remove(infile); + os_remove((char *)infile); vim_free(infile); } rettv->v_type = VAR_STRING; diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 7b04171286..9c843137f6 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1207,9 +1207,9 @@ filterend: EMSG(_("E135: *Filter* Autocommands must not change current buffer")); } if (itmp != NULL) - mch_remove(itmp); + os_remove((char *)itmp); if (otmp != NULL) - mch_remove(otmp); + os_remove((char *)otmp); vim_free(itmp); vim_free(otmp); } @@ -1712,9 +1712,9 @@ void write_viminfo(char_u *file, int forceit) * In case of an error keep the original viminfo file. * Otherwise rename the newly written file. */ - if (viminfo_errcnt || vim_rename(tempname, fname) == -1) - mch_remove(tempname); - + if (viminfo_errcnt || vim_rename(tempname, fname) == -1) { + os_remove((char *)tempname); + } } end: diff --git a/src/fileio.c b/src/fileio.c index 7ae771c6b4..f98ed4ecb9 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -870,7 +870,7 @@ retry: } } if (tmpname != NULL) { - mch_remove(tmpname); /* delete converted file */ + os_remove((char *)tmpname); // delete converted file vim_free(tmpname); tmpname = NULL; } @@ -1786,7 +1786,7 @@ failed: #endif if (tmpname != NULL) { - mch_remove(tmpname); /* delete converted file */ + os_remove((char *)tmpname); // delete converted file vim_free(tmpname); } --no_wait_return; /* may wait for return now */ @@ -2203,7 +2203,7 @@ readfile_charconvert ( * another type of conversion might still work. */ MSG(errmsg); if (tmpname != NULL) { - mch_remove(tmpname); /* delete converted file */ + os_remove((char *)tmpname); // delete converted file vim_free(tmpname); tmpname = NULL; } @@ -2972,7 +2972,7 @@ buf_write ( /* Close the file before removing it, on MS-Windows we * can't delete an open file. */ close(fd); - mch_remove(IObuff); + os_remove((char *)IObuff); } } } @@ -3140,7 +3140,7 @@ buf_write ( */ if (backup != NULL) { /* remove old backup, if present */ - mch_remove(backup); + os_remove((char *)backup); /* Open with O_EXCL to avoid the file being created while * we were sleeping (symlink hacker attack?) */ bfd = mch_open((char *)backup, @@ -3457,7 +3457,7 @@ nobackup: /* * A forced write will try to create a new file if the old one is * still readonly. This may also happen when the directory is - * read-only. In that case the mch_remove() will fail. + * read-only. In that case the os_remove() will fail. */ if (errmsg == NULL) { #ifdef UNIX @@ -3485,7 +3485,7 @@ nobackup: perm &= 0777; #endif if (!append) /* don't remove when appending */ - mch_remove(wfname); + os_remove((char *)wfname); continue; } } @@ -3513,7 +3513,7 @@ restore_backup: vim_rename(backup, fname); /* if original file does exist throw away the copy */ if (mch_stat((char *)fname, &st) >= 0) - mch_remove(backup); + os_remove((char *)backup); } else { /* try to put the original file back */ vim_rename(backup, fname); @@ -3750,7 +3750,7 @@ restore_backup: end = 0; } } - mch_remove(wfname); + os_remove((char *)wfname); vim_free(wfname); } @@ -3951,7 +3951,7 @@ restore_backup: /* * Remove the backup unless 'backup' option is set */ - if (!p_bk && backup != NULL && mch_remove(backup) != 0) + if (!p_bk && backup != NULL && os_remove((char *)backup) != 0) EMSG(_("E207: Can't delete backup file")); @@ -5036,7 +5036,7 @@ int vim_rename(char_u *from, char_u *to) * two files when the os_rename() fails. */ - mch_remove(to); + os_remove((char *)to); /* * First try a normal rename, return if it works. @@ -5109,7 +5109,7 @@ int vim_rename(char_u *from, char_u *to) EMSG2(errmsg, to); return -1; } - mch_remove(from); + os_remove((char *)from); return 0; } @@ -5618,7 +5618,7 @@ void vim_deltempdir(void) if (gen_expand_wildcards(1, &NameBuff, &file_count, &files, EW_DIR|EW_FILE|EW_SILENT) == OK) { for (i = 0; i < file_count; ++i) - mch_remove(files[i]); + os_remove((char *)files[i]); FreeWild(file_count, files); } path_tail(NameBuff)[-1] = NUL; diff --git a/src/if_cscope.c b/src/if_cscope.c index 65155c3421..de3d7a82db 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -1120,7 +1120,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us qf_jump(qi, 0, 0, forceit); } } - mch_remove(tmp); + os_remove((char *)tmp); vim_free(tmp); vim_free(nummatches); return TRUE; diff --git a/src/memfile.c b/src/memfile.c index 30a5ed389d..3ca98603f9 100644 --- a/src/memfile.c +++ b/src/memfile.c @@ -239,7 +239,7 @@ void mf_close(memfile_T *mfp, int del_file) EMSG(_(e_swapclose)); } if (del_file && mfp->mf_fname != NULL) - mch_remove(mfp->mf_fname); + os_remove((char *)mfp->mf_fname); /* free entries in used list */ for (hp = mfp->mf_used_first; hp != NULL; hp = nextp) { total_mem_used -= hp->bh_page_count * mfp->mf_page_size; @@ -285,7 +285,7 @@ mf_close_file ( mfp->mf_fd = -1; if (mfp->mf_fname != NULL) { - mch_remove(mfp->mf_fname); /* delete the swap file */ + os_remove((char *)mfp->mf_fname); // delete the swap file vim_free(mfp->mf_fname); vim_free(mfp->mf_ffname); mfp->mf_fname = NULL; diff --git a/src/memline.c b/src/memline.c index d60f348fc4..469518d70c 100644 --- a/src/memline.c +++ b/src/memline.c @@ -3727,11 +3727,12 @@ findswapname ( same = TRUE; close(f2); if (created2) - mch_remove(fname2); + os_remove((char *)fname2); } close(f1); - if (created1) - mch_remove(fname); + if (created1) { + os_remove((char *)fname); + } } vim_free(fname2); if (same) { @@ -3867,7 +3868,7 @@ findswapname ( if (dummyfd != NULL) { fclose(dummyfd); dummyfd = NULL; - mch_remove(buf_fname); + os_remove(buf_fname); did_use_dummy = TRUE; } #endif @@ -3941,7 +3942,7 @@ findswapname ( swap_exists_action = SEA_RECOVER; break; case 4: - mch_remove(fname); + os_remove((char *)fname); break; case 5: swap_exists_action = SEA_QUIT; @@ -3996,7 +3997,7 @@ findswapname ( #ifdef CREATE_DUMMY_FILE if (dummyfd != NULL) { /* file has been created temporarily */ fclose(dummyfd); - mch_remove(buf_fname); + os_remove(buf_fname); } #endif return fname; diff --git a/src/misc1.c b/src/misc1.c index 180c658064..bf72b0dc3e 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3535,7 +3535,7 @@ get_cmd_output ( buffer = alloc(len + 1); i = (int)fread((char *)buffer, (size_t)1, (size_t)len, fd); fclose(fd); - mch_remove(tempname); + os_remove((char *)tempname); if (buffer == NULL) goto done; if (i != len) { diff --git a/src/os_unix.c b/src/os_unix.c index 9727140597..d5dcde128d 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1256,7 +1256,7 @@ int flags; /* EW_* flags */ vim_free(command); if (i != 0) { /* mch_call_shell() failed */ - mch_remove(tempname); + os_remove((char *)tempname); vim_free(tempname); /* * With interactive completion, the error message is not printed. @@ -1296,7 +1296,7 @@ int flags; /* EW_* flags */ buffer = alloc(len + 1); i = fread((char *)buffer, 1, len, fd); fclose(fd); - mch_remove(tempname); + os_remove((char *)tempname); if (i != (int)len) { /* unexpected read error */ EMSG2(_(e_notread), tempname); diff --git a/src/os_unix_defs.h b/src/os_unix_defs.h index 621e461030..f4ae6b95ba 100644 --- a/src/os_unix_defs.h +++ b/src/os_unix_defs.h @@ -32,7 +32,6 @@ #define vim_mkdir(x, y) os_mkdir((char *)(x), (y)) #define mch_rmdir(x) os_rmdir((char *)(x)) -#define mch_remove(x) os_remove((char *)(x)) /* The number of arguments to a signal handler is configured here. */ /* It used to be a long list of almost all systems. Any system that doesn't diff --git a/src/quickfix.c b/src/quickfix.c index fe0ef8ad6a..a480fe03ae 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2509,7 +2509,7 @@ void ex_make(exarg_T *eap) fname = get_mef_name(); if (fname == NULL) return; - mch_remove(fname); /* in case it's not unique */ + os_remove((char *)fname); // in case it's not unique /* * If 'shellpipe' empty: don't redirect to 'errorfile'. @@ -2554,7 +2554,7 @@ void ex_make(exarg_T *eap) if (res > 0 && !eap->forceit) qf_jump(qi, 0, 0, FALSE); /* display first error */ - mch_remove(fname); + os_remove((char *)fname); vim_free(fname); vim_free(cmd); } diff --git a/src/spell.c b/src/spell.c index 60e1fb172c..ea3f0787e3 100644 --- a/src/spell.c +++ b/src/spell.c @@ -4228,9 +4228,9 @@ void spell_delete_wordlist(void) char_u fname[MAXPATHL]; if (int_wordlist != NULL) { - mch_remove(int_wordlist); + os_remove((char *)int_wordlist); int_wordlist_spl(fname); - mch_remove(fname); + os_remove((char *)fname); vim_free(int_wordlist); int_wordlist = NULL; } diff --git a/src/undo.c b/src/undo.c index f4e95c43f7..c4345ccf7e 100644 --- a/src/undo.c +++ b/src/undo.c @@ -1189,7 +1189,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) } } } - mch_remove(file_name); + os_remove((char *)file_name); } /* If there is no undo information at all, quit here after deleting any @@ -1242,7 +1242,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) if (fp == NULL) { EMSG2(_(e_not_open), file_name); close(fd); - mch_remove(file_name); + os_remove((char *)file_name); goto theend; }