Mercurial > vim
annotate src/xdiff/xinclude.h @ 18412:6208e5c2eee7 v8.1.2200
patch 8.1.2200: crash when memory allocation fails
Commit: https://github.com/vim/vim/commit/1cac70953d3c012453ea85b1308a8b1f94359c26
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 22 21:54:31 2019 +0200
patch 8.1.2200: crash when memory allocation fails
Problem: Crash when memory allocation fails.
Solution: Check for NULL curwin and curbuf. (Christian Brabandt,
closes #4839)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 22 Oct 2019 22:00:05 +0200 |
parents | 2ad5f0ffaa2e |
children | 3be01cf0a632 |
rev | line source |
---|---|
14696
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 /* |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 * LibXDiff by Davide Libenzi ( File Differential Library ) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 * Copyright (C) 2003 Davide Libenzi |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Lesser General Public |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 * License as published by the Free Software Foundation; either |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 * version 2.1 of the License, or (at your option) any later version. |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 * License along with this library; if not, see |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 * <http://www.gnu.org/licenses/>. |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 * Davide Libenzi <davidel@xmailserver.org> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 * |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 */ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 /* defines HAVE_ATTRIBUTE_UNUSED */ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
15517
2ad5f0ffaa2e
patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents:
14696
diff
changeset
|
25 # ifdef VMS |
2ad5f0ffaa2e
patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents:
14696
diff
changeset
|
26 # include "[.auto]config.h" |
2ad5f0ffaa2e
patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents:
14696
diff
changeset
|
27 # else |
2ad5f0ffaa2e
patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents:
14696
diff
changeset
|
28 # include "../auto/config.h" |
2ad5f0ffaa2e
patch 8.1.0766: various problems when using Vim on VMS
Bram Moolenaar <Bram@vim.org>
parents:
14696
diff
changeset
|
29 # endif |
14696
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 #endif |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 /* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 * can be used to check for mistakes. */ |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 #ifdef HAVE_ATTRIBUTE_UNUSED |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 # define UNUSED __attribute__((unused)) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 #else |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 # define UNUSED |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 #endif |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 #if defined(_MSC_VER) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 # define inline __inline |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 #endif |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 #if !defined(XINCLUDE_H) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 #define XINCLUDE_H |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 #include <ctype.h> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 #include <stdio.h> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 #include <stdlib.h> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 #if !defined(_WIN32) |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 #include <unistd.h> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 #endif |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 #include <string.h> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 #include <limits.h> |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 #include "xmacros.h" |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 #include "xdiff.h" |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 #include "xtypes.h" |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 #include "xutils.h" |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 #include "xprepare.h" |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 #include "xdiffi.h" |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 #include "xemit.h" |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 |
195e8b1fcbbf
patch 8.1.0360: using an external diff program is slow and inflexible
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 #endif /* #if !defined(XINCLUDE_H) */ |