Mercurial > vim
comparison src/os_unix.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 | cf33c47d66aa |
children | 421e120ffb30 |
comparison
equal
deleted
inserted
replaced
14729:7cb784c3b08f | 14730:193471015e1a |
---|---|
355 * Write s[len] to the screen (stdout). | 355 * Write s[len] to the screen (stdout). |
356 */ | 356 */ |
357 void | 357 void |
358 mch_write(char_u *s, int len) | 358 mch_write(char_u *s, int len) |
359 { | 359 { |
360 ignored = (int)write(1, (char *)s, len); | 360 vim_ignored = (int)write(1, (char *)s, len); |
361 if (p_wd) /* Unix is too fast, slow down a bit more */ | 361 if (p_wd) /* Unix is too fast, slow down a bit more */ |
362 RealWaitForChar(read_cmd_fd, p_wd, NULL, NULL); | 362 RealWaitForChar(read_cmd_fd, p_wd, NULL, NULL); |
363 } | 363 } |
364 | 364 |
365 /* | 365 /* |
4691 * or dup() failed we'd just do the same thing ourselves | 4691 * or dup() failed we'd just do the same thing ourselves |
4692 * anyway -- webb | 4692 * anyway -- webb |
4693 */ | 4693 */ |
4694 if (fd >= 0) | 4694 if (fd >= 0) |
4695 { | 4695 { |
4696 ignored = dup(fd); /* To replace stdin (fd 0) */ | 4696 vim_ignored = dup(fd); /* To replace stdin (fd 0) */ |
4697 ignored = dup(fd); /* To replace stdout (fd 1) */ | 4697 vim_ignored = dup(fd); /* To replace stdout (fd 1) */ |
4698 ignored = dup(fd); /* To replace stderr (fd 2) */ | 4698 vim_ignored = dup(fd); /* To replace stderr (fd 2) */ |
4699 | 4699 |
4700 /* Don't need this now that we've duplicated it */ | 4700 /* Don't need this now that we've duplicated it */ |
4701 close(fd); | 4701 close(fd); |
4702 } | 4702 } |
4703 } | 4703 } |
4750 { | 4750 { |
4751 close(pty_master_fd); /* close master side of pty */ | 4751 close(pty_master_fd); /* close master side of pty */ |
4752 | 4752 |
4753 /* set up stdin/stdout/stderr for the child */ | 4753 /* set up stdin/stdout/stderr for the child */ |
4754 close(0); | 4754 close(0); |
4755 ignored = dup(pty_slave_fd); | 4755 vim_ignored = dup(pty_slave_fd); |
4756 close(1); | 4756 close(1); |
4757 ignored = dup(pty_slave_fd); | 4757 vim_ignored = dup(pty_slave_fd); |
4758 if (gui.in_use) | 4758 if (gui.in_use) |
4759 { | 4759 { |
4760 close(2); | 4760 close(2); |
4761 ignored = dup(pty_slave_fd); | 4761 vim_ignored = dup(pty_slave_fd); |
4762 } | 4762 } |
4763 | 4763 |
4764 close(pty_slave_fd); /* has been dupped, close it now */ | 4764 close(pty_slave_fd); /* has been dupped, close it now */ |
4765 } | 4765 } |
4766 else | 4766 else |
4767 # endif | 4767 # endif |
4768 { | 4768 { |
4769 /* set up stdin for the child */ | 4769 /* set up stdin for the child */ |
4770 close(fd_toshell[1]); | 4770 close(fd_toshell[1]); |
4771 close(0); | 4771 close(0); |
4772 ignored = dup(fd_toshell[0]); | 4772 vim_ignored = dup(fd_toshell[0]); |
4773 close(fd_toshell[0]); | 4773 close(fd_toshell[0]); |
4774 | 4774 |
4775 /* set up stdout for the child */ | 4775 /* set up stdout for the child */ |
4776 close(fd_fromshell[0]); | 4776 close(fd_fromshell[0]); |
4777 close(1); | 4777 close(1); |
4778 ignored = dup(fd_fromshell[1]); | 4778 vim_ignored = dup(fd_fromshell[1]); |
4779 close(fd_fromshell[1]); | 4779 close(fd_fromshell[1]); |
4780 | 4780 |
4781 # ifdef FEAT_GUI | 4781 # ifdef FEAT_GUI |
4782 if (gui.in_use) | 4782 if (gui.in_use) |
4783 { | 4783 { |
4784 /* set up stderr for the child */ | 4784 /* set up stderr for the child */ |
4785 close(2); | 4785 close(2); |
4786 ignored = dup(1); | 4786 vim_ignored = dup(1); |
4787 } | 4787 } |
4788 # endif | 4788 # endif |
4789 } | 4789 } |
4790 } | 4790 } |
4791 | 4791 |
4918 && curbuf->b_p_fixeol) | 4918 && curbuf->b_p_fixeol) |
4919 || (lnum != curbuf->b_no_eol_lnum | 4919 || (lnum != curbuf->b_no_eol_lnum |
4920 && (lnum != | 4920 && (lnum != |
4921 curbuf->b_ml.ml_line_count | 4921 curbuf->b_ml.ml_line_count |
4922 || curbuf->b_p_eol))) | 4922 || curbuf->b_p_eol))) |
4923 ignored = write(toshell_fd, "\n", | 4923 vim_ignored = write(toshell_fd, "\n", |
4924 (size_t)1); | 4924 (size_t)1); |
4925 ++lnum; | 4925 ++lnum; |
4926 if (lnum > curbuf->b_op_end.lnum) | 4926 if (lnum > curbuf->b_op_end.lnum) |
4927 { | 4927 { |
4928 /* finished all the lines, close pipe */ | 4928 /* finished all the lines, close pipe */ |
5609 } | 5609 } |
5610 | 5610 |
5611 /* set up stdin for the child */ | 5611 /* set up stdin for the child */ |
5612 close(0); | 5612 close(0); |
5613 if (use_null_for_in && null_fd >= 0) | 5613 if (use_null_for_in && null_fd >= 0) |
5614 ignored = dup(null_fd); | 5614 vim_ignored = dup(null_fd); |
5615 else if (fd_in[0] < 0) | 5615 else if (fd_in[0] < 0) |
5616 ignored = dup(pty_slave_fd); | 5616 vim_ignored = dup(pty_slave_fd); |
5617 else | 5617 else |
5618 ignored = dup(fd_in[0]); | 5618 vim_ignored = dup(fd_in[0]); |
5619 | 5619 |
5620 /* set up stderr for the child */ | 5620 /* set up stderr for the child */ |
5621 close(2); | 5621 close(2); |
5622 if (use_null_for_err && null_fd >= 0) | 5622 if (use_null_for_err && null_fd >= 0) |
5623 { | 5623 { |
5624 ignored = dup(null_fd); | 5624 vim_ignored = dup(null_fd); |
5625 stderr_works = FALSE; | 5625 stderr_works = FALSE; |
5626 } | 5626 } |
5627 else if (use_out_for_err) | 5627 else if (use_out_for_err) |
5628 ignored = dup(fd_out[1]); | 5628 vim_ignored = dup(fd_out[1]); |
5629 else if (fd_err[1] < 0) | 5629 else if (fd_err[1] < 0) |
5630 ignored = dup(pty_slave_fd); | 5630 vim_ignored = dup(pty_slave_fd); |
5631 else | 5631 else |
5632 ignored = dup(fd_err[1]); | 5632 vim_ignored = dup(fd_err[1]); |
5633 | 5633 |
5634 /* set up stdout for the child */ | 5634 /* set up stdout for the child */ |
5635 close(1); | 5635 close(1); |
5636 if (use_null_for_out && null_fd >= 0) | 5636 if (use_null_for_out && null_fd >= 0) |
5637 ignored = dup(null_fd); | 5637 vim_ignored = dup(null_fd); |
5638 else if (fd_out[1] < 0) | 5638 else if (fd_out[1] < 0) |
5639 ignored = dup(pty_slave_fd); | 5639 vim_ignored = dup(pty_slave_fd); |
5640 else | 5640 else |
5641 ignored = dup(fd_out[1]); | 5641 vim_ignored = dup(fd_out[1]); |
5642 | 5642 |
5643 if (fd_in[0] >= 0) | 5643 if (fd_in[0] >= 0) |
5644 close(fd_in[0]); | 5644 close(fd_in[0]); |
5645 if (fd_in[1] >= 0) | 5645 if (fd_in[1] >= 0) |
5646 close(fd_in[1]); | 5646 close(fd_in[1]); |