removed mch_remove macro

This commit is contained in:
Stefan Hoffmann 2014-04-08 22:01:33 +02:00 committed by Thiago de Arruda
parent 445f31f076
commit a1df458524
13 changed files with 50 additions and 50 deletions

View File

@ -728,10 +728,10 @@ void ex_diffupdate(exarg_T *eap)
} }
fclose(fd); fclose(fd);
} }
mch_remove(tmp_diff); os_remove((char *)tmp_diff);
mch_remove(tmp_new); os_remove((char *)tmp_new);
} }
mch_remove(tmp_orig); os_remove((char *)tmp_orig);
} }
// When using 'diffexpr' break here. // 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. // Read the diff output and add each entry to the diff list.
diff_read(idx_orig, idx_new, tmp_diff); diff_read(idx_orig, idx_new, tmp_diff);
mch_remove(tmp_diff); os_remove((char *)tmp_diff);
mch_remove(tmp_new); os_remove((char *)tmp_new);
} }
mch_remove(tmp_orig); os_remove((char *)tmp_orig);
// force updating cursor position on screen // force updating cursor position on screen
curwin->w_valid_cursor.lnum = 0; curwin->w_valid_cursor.lnum = 0;
@ -959,10 +959,10 @@ void ex_diffpatch(exarg_T *eap)
// Delete any .orig or .rej file created. // Delete any .orig or .rej file created.
STRCPY(buf, tmp_new); STRCPY(buf, tmp_new);
STRCAT(buf, ".orig"); STRCAT(buf, ".orig");
mch_remove(buf); os_remove((char *)buf);
STRCPY(buf, tmp_new); STRCPY(buf, tmp_new);
STRCAT(buf, ".rej"); STRCAT(buf, ".rej");
mch_remove(buf); os_remove((char *)buf);
// Only continue if the output file was created. // Only continue if the output file was created.
if ((mch_stat((char *)tmp_new, &st) < 0) || (st.st_size == 0)) { if ((mch_stat((char *)tmp_new, &st) < 0) || (st.st_size == 0)) {
@ -1008,12 +1008,12 @@ void ex_diffpatch(exarg_T *eap)
theend: theend:
if (tmp_orig != NULL) { if (tmp_orig != NULL) {
mch_remove(tmp_orig); os_remove((char *)tmp_orig);
} }
vim_free(tmp_orig); vim_free(tmp_orig);
if (tmp_new != NULL) { if (tmp_new != NULL) {
mch_remove(tmp_new); os_remove((char *)tmp_new);
} }
vim_free(tmp_new); vim_free(tmp_new);
vim_free(newname); vim_free(newname);

View File

@ -1187,7 +1187,7 @@ int eval_printexpr(char_u *fname, char_u *args)
set_vim_var_string(VV_CMDARG, NULL, -1); set_vim_var_string(VV_CMDARG, NULL, -1);
if (err) { if (err) {
mch_remove(fname); os_remove((char *)fname);
return FAIL; return FAIL;
} }
return OK; return OK;
@ -8413,7 +8413,7 @@ static void f_delete(typval_T *argvars, typval_T *rettv)
if (check_restricted() || check_secure()) if (check_restricted() || check_secure())
rettv->vval.v_number = -1; rettv->vval.v_number = -1;
else 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: done:
if (infile != NULL) { if (infile != NULL) {
mch_remove(infile); os_remove((char *)infile);
vim_free(infile); vim_free(infile);
} }
rettv->v_type = VAR_STRING; rettv->v_type = VAR_STRING;

View File

@ -1207,9 +1207,9 @@ filterend:
EMSG(_("E135: *Filter* Autocommands must not change current buffer")); EMSG(_("E135: *Filter* Autocommands must not change current buffer"));
} }
if (itmp != NULL) if (itmp != NULL)
mch_remove(itmp); os_remove((char *)itmp);
if (otmp != NULL) if (otmp != NULL)
mch_remove(otmp); os_remove((char *)otmp);
vim_free(itmp); vim_free(itmp);
vim_free(otmp); 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. * In case of an error keep the original viminfo file.
* Otherwise rename the newly written file. * Otherwise rename the newly written file.
*/ */
if (viminfo_errcnt || vim_rename(tempname, fname) == -1) if (viminfo_errcnt || vim_rename(tempname, fname) == -1) {
mch_remove(tempname); os_remove((char *)tempname);
}
} }
end: end:

View File

@ -870,7 +870,7 @@ retry:
} }
} }
if (tmpname != NULL) { if (tmpname != NULL) {
mch_remove(tmpname); /* delete converted file */ os_remove((char *)tmpname); // delete converted file
vim_free(tmpname); vim_free(tmpname);
tmpname = NULL; tmpname = NULL;
} }
@ -1786,7 +1786,7 @@ failed:
#endif #endif
if (tmpname != NULL) { if (tmpname != NULL) {
mch_remove(tmpname); /* delete converted file */ os_remove((char *)tmpname); // delete converted file
vim_free(tmpname); vim_free(tmpname);
} }
--no_wait_return; /* may wait for return now */ --no_wait_return; /* may wait for return now */
@ -2203,7 +2203,7 @@ readfile_charconvert (
* another type of conversion might still work. */ * another type of conversion might still work. */
MSG(errmsg); MSG(errmsg);
if (tmpname != NULL) { if (tmpname != NULL) {
mch_remove(tmpname); /* delete converted file */ os_remove((char *)tmpname); // delete converted file
vim_free(tmpname); vim_free(tmpname);
tmpname = NULL; tmpname = NULL;
} }
@ -2972,7 +2972,7 @@ buf_write (
/* Close the file before removing it, on MS-Windows we /* Close the file before removing it, on MS-Windows we
* can't delete an open file. */ * can't delete an open file. */
close(fd); close(fd);
mch_remove(IObuff); os_remove((char *)IObuff);
} }
} }
} }
@ -3140,7 +3140,7 @@ buf_write (
*/ */
if (backup != NULL) { if (backup != NULL) {
/* remove old backup, if present */ /* remove old backup, if present */
mch_remove(backup); os_remove((char *)backup);
/* Open with O_EXCL to avoid the file being created while /* Open with O_EXCL to avoid the file being created while
* we were sleeping (symlink hacker attack?) */ * we were sleeping (symlink hacker attack?) */
bfd = mch_open((char *)backup, 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 * 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 * 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) { if (errmsg == NULL) {
#ifdef UNIX #ifdef UNIX
@ -3485,7 +3485,7 @@ nobackup:
perm &= 0777; perm &= 0777;
#endif #endif
if (!append) /* don't remove when appending */ if (!append) /* don't remove when appending */
mch_remove(wfname); os_remove((char *)wfname);
continue; continue;
} }
} }
@ -3513,7 +3513,7 @@ restore_backup:
vim_rename(backup, fname); vim_rename(backup, fname);
/* if original file does exist throw away the copy */ /* if original file does exist throw away the copy */
if (mch_stat((char *)fname, &st) >= 0) if (mch_stat((char *)fname, &st) >= 0)
mch_remove(backup); os_remove((char *)backup);
} else { } else {
/* try to put the original file back */ /* try to put the original file back */
vim_rename(backup, fname); vim_rename(backup, fname);
@ -3750,7 +3750,7 @@ restore_backup:
end = 0; end = 0;
} }
} }
mch_remove(wfname); os_remove((char *)wfname);
vim_free(wfname); vim_free(wfname);
} }
@ -3951,7 +3951,7 @@ restore_backup:
/* /*
* Remove the backup unless 'backup' option is set * 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")); 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. * two files when the os_rename() fails.
*/ */
mch_remove(to); os_remove((char *)to);
/* /*
* First try a normal rename, return if it works. * 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); EMSG2(errmsg, to);
return -1; return -1;
} }
mch_remove(from); os_remove((char *)from);
return 0; return 0;
} }
@ -5618,7 +5618,7 @@ void vim_deltempdir(void)
if (gen_expand_wildcards(1, &NameBuff, &file_count, &files, if (gen_expand_wildcards(1, &NameBuff, &file_count, &files,
EW_DIR|EW_FILE|EW_SILENT) == OK) { EW_DIR|EW_FILE|EW_SILENT) == OK) {
for (i = 0; i < file_count; ++i) for (i = 0; i < file_count; ++i)
mch_remove(files[i]); os_remove((char *)files[i]);
FreeWild(file_count, files); FreeWild(file_count, files);
} }
path_tail(NameBuff)[-1] = NUL; path_tail(NameBuff)[-1] = NUL;

View File

@ -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); qf_jump(qi, 0, 0, forceit);
} }
} }
mch_remove(tmp); os_remove((char *)tmp);
vim_free(tmp); vim_free(tmp);
vim_free(nummatches); vim_free(nummatches);
return TRUE; return TRUE;

View File

@ -239,7 +239,7 @@ void mf_close(memfile_T *mfp, int del_file)
EMSG(_(e_swapclose)); EMSG(_(e_swapclose));
} }
if (del_file && mfp->mf_fname != NULL) if (del_file && mfp->mf_fname != NULL)
mch_remove(mfp->mf_fname); os_remove((char *)mfp->mf_fname);
/* free entries in used list */ /* free entries in used list */
for (hp = mfp->mf_used_first; hp != NULL; hp = nextp) { for (hp = mfp->mf_used_first; hp != NULL; hp = nextp) {
total_mem_used -= hp->bh_page_count * mfp->mf_page_size; total_mem_used -= hp->bh_page_count * mfp->mf_page_size;
@ -285,7 +285,7 @@ mf_close_file (
mfp->mf_fd = -1; mfp->mf_fd = -1;
if (mfp->mf_fname != NULL) { 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_fname);
vim_free(mfp->mf_ffname); vim_free(mfp->mf_ffname);
mfp->mf_fname = NULL; mfp->mf_fname = NULL;

View File

@ -3727,11 +3727,12 @@ findswapname (
same = TRUE; same = TRUE;
close(f2); close(f2);
if (created2) if (created2)
mch_remove(fname2); os_remove((char *)fname2);
} }
close(f1); close(f1);
if (created1) if (created1) {
mch_remove(fname); os_remove((char *)fname);
}
} }
vim_free(fname2); vim_free(fname2);
if (same) { if (same) {
@ -3867,7 +3868,7 @@ findswapname (
if (dummyfd != NULL) { if (dummyfd != NULL) {
fclose(dummyfd); fclose(dummyfd);
dummyfd = NULL; dummyfd = NULL;
mch_remove(buf_fname); os_remove(buf_fname);
did_use_dummy = TRUE; did_use_dummy = TRUE;
} }
#endif #endif
@ -3941,7 +3942,7 @@ findswapname (
swap_exists_action = SEA_RECOVER; swap_exists_action = SEA_RECOVER;
break; break;
case 4: case 4:
mch_remove(fname); os_remove((char *)fname);
break; break;
case 5: case 5:
swap_exists_action = SEA_QUIT; swap_exists_action = SEA_QUIT;
@ -3996,7 +3997,7 @@ findswapname (
#ifdef CREATE_DUMMY_FILE #ifdef CREATE_DUMMY_FILE
if (dummyfd != NULL) { /* file has been created temporarily */ if (dummyfd != NULL) { /* file has been created temporarily */
fclose(dummyfd); fclose(dummyfd);
mch_remove(buf_fname); os_remove(buf_fname);
} }
#endif #endif
return fname; return fname;

View File

@ -3535,7 +3535,7 @@ get_cmd_output (
buffer = alloc(len + 1); buffer = alloc(len + 1);
i = (int)fread((char *)buffer, (size_t)1, (size_t)len, fd); i = (int)fread((char *)buffer, (size_t)1, (size_t)len, fd);
fclose(fd); fclose(fd);
mch_remove(tempname); os_remove((char *)tempname);
if (buffer == NULL) if (buffer == NULL)
goto done; goto done;
if (i != len) { if (i != len) {

View File

@ -1256,7 +1256,7 @@ int flags; /* EW_* flags */
vim_free(command); vim_free(command);
if (i != 0) { /* mch_call_shell() failed */ if (i != 0) { /* mch_call_shell() failed */
mch_remove(tempname); os_remove((char *)tempname);
vim_free(tempname); vim_free(tempname);
/* /*
* With interactive completion, the error message is not printed. * With interactive completion, the error message is not printed.
@ -1296,7 +1296,7 @@ int flags; /* EW_* flags */
buffer = alloc(len + 1); buffer = alloc(len + 1);
i = fread((char *)buffer, 1, len, fd); i = fread((char *)buffer, 1, len, fd);
fclose(fd); fclose(fd);
mch_remove(tempname); os_remove((char *)tempname);
if (i != (int)len) { if (i != (int)len) {
/* unexpected read error */ /* unexpected read error */
EMSG2(_(e_notread), tempname); EMSG2(_(e_notread), tempname);

View File

@ -32,7 +32,6 @@
#define vim_mkdir(x, y) os_mkdir((char *)(x), (y)) #define vim_mkdir(x, y) os_mkdir((char *)(x), (y))
#define mch_rmdir(x) os_rmdir((char *)(x)) #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. */ /* 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 /* It used to be a long list of almost all systems. Any system that doesn't

View File

@ -2509,7 +2509,7 @@ void ex_make(exarg_T *eap)
fname = get_mef_name(); fname = get_mef_name();
if (fname == NULL) if (fname == NULL)
return; 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'. * If 'shellpipe' empty: don't redirect to 'errorfile'.
@ -2554,7 +2554,7 @@ void ex_make(exarg_T *eap)
if (res > 0 && !eap->forceit) if (res > 0 && !eap->forceit)
qf_jump(qi, 0, 0, FALSE); /* display first error */ qf_jump(qi, 0, 0, FALSE); /* display first error */
mch_remove(fname); os_remove((char *)fname);
vim_free(fname); vim_free(fname);
vim_free(cmd); vim_free(cmd);
} }

View File

@ -4228,9 +4228,9 @@ void spell_delete_wordlist(void)
char_u fname[MAXPATHL]; char_u fname[MAXPATHL];
if (int_wordlist != NULL) { if (int_wordlist != NULL) {
mch_remove(int_wordlist); os_remove((char *)int_wordlist);
int_wordlist_spl(fname); int_wordlist_spl(fname);
mch_remove(fname); os_remove((char *)fname);
vim_free(int_wordlist); vim_free(int_wordlist);
int_wordlist = NULL; int_wordlist = NULL;
} }

View File

@ -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 /* 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) { if (fp == NULL) {
EMSG2(_(e_not_open), file_name); EMSG2(_(e_not_open), file_name);
close(fd); close(fd);
mch_remove(file_name); os_remove((char *)file_name);
goto theend; goto theend;
} }