python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / screen / 0002-no-memcpy-fallback.patch
blobf3a6a70d2ad617df79b16a5f8d3f0a3e08637a9b
1 From: Maarten ter Huurne <maarten@treewalker.org>
2 Date: Sat, 13 Sep 2014 11:37:59 +0200
3 Subject: Do not use memcpy as an alternative for bcopy/memmove
5 The configure script runs a small test program to check whether
6 memcpy can handle overlapping memory areas. However, it is not valid
7 to conclude that if a single case of overlapping memory is handled
8 correctly, all cases will be handled correctly.
10 Since screen already has its own bcopy implementation as a fallback
11 for the case that bcopy and memmove are unusable, removing the memcpy
12 option should not break any systems.
14 Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
15 [Ricardo: rebase on top of 4.3.1]
16 Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
17 ---
18 acconfig.h | 3 +--
19 configure.ac | 18 +-----------------
20 os.h | 8 ++------
21 osdef.h.in | 10 +---------
22 4 files changed, 5 insertions(+), 34 deletions(-)
24 diff --git a/acconfig.h b/acconfig.h
25 index 2e46985..9b0b9d4 100644
26 --- a/acconfig.h
27 +++ b/acconfig.h
28 @@ -476,7 +476,7 @@
29 #undef GETTTYENT
32 - * Define USEBCOPY if the bcopy/memcpy from your system's C library
33 + * Define USEBCOPY if the bcopy from your system's C library
34 * supports the overlapping of source and destination blocks. When
35 * undefined, screen uses its own (probably slower) version of bcopy().
37 @@ -487,7 +487,6 @@
38 * Their memove fails the test in the configure script. Sigh. (Juergen)
40 #undef USEBCOPY
41 -#undef USEMEMCPY
42 #undef USEMEMMOVE
45 diff --git a/configure.ac b/configure.ac
46 index 27690a6..b8e3bec 100644
47 --- a/configure.ac
48 +++ b/configure.ac
49 @@ -1145,7 +1145,7 @@ AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
50 AC_CHECKING(fdwalk)
51 AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
53 -AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
54 +AC_CHECKING(whether memmove/bcopy handles overlapping arguments)
55 AC_TRY_RUN([
56 main() {
57 char buf[10];
58 @@ -1175,22 +1175,6 @@ main() {
59 exit(0); /* libc version works properly. */
60 }], AC_DEFINE(USEMEMMOVE))
63 -AC_TRY_RUN([
64 -#define bcopy(s,d,l) memcpy(d,s,l)
65 -main() {
66 - char buf[10];
67 - strcpy(buf, "abcdefghi");
68 - bcopy(buf, buf + 2, 3);
69 - if (strncmp(buf, "ababcf", 6))
70 - exit(1);
71 - strcpy(buf, "abcdefghi");
72 - bcopy(buf + 2, buf, 3);
73 - if (strncmp(buf, "cdedef", 6))
74 - exit(1);
75 - exit(0); /* libc version works properly. */
76 -}], AC_DEFINE(USEMEMCPY))
78 AC_SYS_LONG_FILE_NAMES
80 AC_MSG_CHECKING(for vsprintf)
81 diff --git a/os.h b/os.h
82 index e827ac9..0b41fb9 100644
83 --- a/os.h
84 +++ b/os.h
85 @@ -142,12 +142,8 @@ extern int errno;
86 # ifdef USEMEMMOVE
87 # define bcopy(s,d,len) memmove(d,s,len)
88 # else
89 -# ifdef USEMEMCPY
90 -# define bcopy(s,d,len) memcpy(d,s,len)
91 -# else
92 -# define NEED_OWN_BCOPY
93 -# define bcopy xbcopy
94 -# endif
95 +# define NEED_OWN_BCOPY
96 +# define bcopy xbcopy
97 # endif
98 #endif
100 diff --git a/osdef.h.in b/osdef.h.in
101 index 8687b60..e4057a0 100644
102 --- a/osdef.h.in
103 +++ b/osdef.h.in
104 @@ -58,16 +58,8 @@ extern int bcmp __P((char *, char *, int));
105 extern int killpg __P((int, int));
106 #endif
108 -#ifndef USEBCOPY
109 -# ifdef USEMEMCPY
110 -extern void memcpy __P((char *, char *, int));
111 -# else
112 -# ifdef USEMEMMOVE
113 +#if defined(USEMEMMOVE) && !defined(USEBCOPY)
114 extern void memmove __P((char *, char *, int));
115 -# else
116 -extern void bcopy __P((char *, char *, int));
117 -# endif
118 -# endif
119 #else
120 extern void bcopy __P((char *, char *, int));
121 #endif
123 1.8.4.5