Mercurial > vim
comparison src/fileio.c @ 14730:193471015e1a v8.1.0377
patch 8.1.0377: xdiff doesn't use the Vim memory allocation functions
commit https://github.com/vim/vim/commit/42335f50bc6fac444a8af74c81df8369d722a6fb
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 13 15:33:43 2018 +0200
patch 8.1.0377: xdiff doesn't use the Vim memory allocation functions
Problem: Xdiff doesn't use the Vim memory allocation functions.
Solution: Change the xdl_ defines. Check for out-of-memory. Rename
"ignored" to "vim_ignored".
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 13 Sep 2018 15:45:05 +0200 |
parents | 0a3b9ecf7cb8 |
children | 27055ad9276b |
comparison
equal
deleted
inserted
replaced
14729:7cb784c3b08f | 14730:193471015e1a |
---|---|
2406 #ifdef HAVE_DUP | 2406 #ifdef HAVE_DUP |
2407 if (read_stdin) | 2407 if (read_stdin) |
2408 { | 2408 { |
2409 /* Use stderr for stdin, makes shell commands work. */ | 2409 /* Use stderr for stdin, makes shell commands work. */ |
2410 close(0); | 2410 close(0); |
2411 ignored = dup(2); | 2411 vim_ignored = dup(2); |
2412 } | 2412 } |
2413 #endif | 2413 #endif |
2414 | 2414 |
2415 #ifdef FEAT_MBYTE | 2415 #ifdef FEAT_MBYTE |
2416 if (tmpname != NULL) | 2416 if (tmpname != NULL) |
3749 backup_copy = TRUE; | 3749 backup_copy = TRUE; |
3750 else | 3750 else |
3751 { | 3751 { |
3752 # ifdef UNIX | 3752 # ifdef UNIX |
3753 # ifdef HAVE_FCHOWN | 3753 # ifdef HAVE_FCHOWN |
3754 ignored = fchown(fd, st_old.st_uid, st_old.st_gid); | 3754 vim_ignored = fchown(fd, st_old.st_uid, st_old.st_gid); |
3755 # endif | 3755 # endif |
3756 if (mch_stat((char *)IObuff, &st) < 0 | 3756 if (mch_stat((char *)IObuff, &st) < 0 |
3757 || st.st_uid != st_old.st_uid | 3757 || st.st_uid != st_old.st_uid |
3758 || st.st_gid != st_old.st_gid | 3758 || st.st_gid != st_old.st_gid |
3759 || (long)st.st_mode != perm) | 3759 || (long)st.st_mode != perm) |
4507 } | 4507 } |
4508 } | 4508 } |
4509 #endif | 4509 #endif |
4510 #ifdef HAVE_FTRUNCATE | 4510 #ifdef HAVE_FTRUNCATE |
4511 if (!append) | 4511 if (!append) |
4512 ignored = ftruncate(fd, (off_t)0); | 4512 vim_ignored = ftruncate(fd, (off_t)0); |
4513 #endif | 4513 #endif |
4514 | 4514 |
4515 #if defined(WIN3264) | 4515 #if defined(WIN3264) |
4516 if (backup != NULL && overwriting && !append) | 4516 if (backup != NULL && overwriting && !append) |
4517 { | 4517 { |
4787 if (mch_stat((char *)wfname, &st) < 0 | 4787 if (mch_stat((char *)wfname, &st) < 0 |
4788 || st.st_uid != st_old.st_uid | 4788 || st.st_uid != st_old.st_uid |
4789 || st.st_gid != st_old.st_gid) | 4789 || st.st_gid != st_old.st_gid) |
4790 { | 4790 { |
4791 /* changing owner might not be possible */ | 4791 /* changing owner might not be possible */ |
4792 ignored = fchown(fd, st_old.st_uid, -1); | 4792 vim_ignored = fchown(fd, st_old.st_uid, -1); |
4793 /* if changing group fails clear the group permissions */ | 4793 /* if changing group fails clear the group permissions */ |
4794 if (fchown(fd, -1, st_old.st_gid) == -1 && perm > 0) | 4794 if (fchown(fd, -1, st_old.st_gid) == -1 && perm > 0) |
4795 perm &= ~070; | 4795 perm &= ~070; |
4796 } | 4796 } |
4797 # endif | 4797 # endif |
6480 /* Now throw away the rest of the line: */ | 6480 /* Now throw away the rest of the line: */ |
6481 do | 6481 do |
6482 { | 6482 { |
6483 tbuf[FGETS_SIZE - 2] = NUL; | 6483 tbuf[FGETS_SIZE - 2] = NUL; |
6484 #ifdef USE_CR | 6484 #ifdef USE_CR |
6485 ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp); | 6485 vim_ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp); |
6486 #else | 6486 #else |
6487 ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); | 6487 vim_ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); |
6488 #endif | 6488 #endif |
6489 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); | 6489 } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); |
6490 } | 6490 } |
6491 return (eof == NULL); | 6491 return (eof == NULL); |
6492 } | 6492 } |