summaryrefslogtreecommitdiffstats
path: root/mysql-strmov.patch
blob: 034ce6c2c4d8e71fd9a660255951763fdbbbef44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Remove overly optimistic definition of strmov() as stpcpy().

mysql uses this macro with overlapping source and destination strings,
which is verboten per spec, and fails on some Red Hat platforms.
Deleting the definition is sufficient to make it fall back to a
byte-at-a-time copy loop, which should consistently give the
expected behavior.

Note: the particular case that prompted this patch is reported and fixed
at http://bugs.mysql.com/bug.php?id=48864.  However, my faith in upstream's
ability to detect this type of error is low, and I also see little evidence
of any real performance gain from optimizing these calls.  So I'm keeping
this patch.


--- mysql-5.6.10/include/m_string.h.old	2013-02-13 09:19:41.617326626 +0100
+++ mysql-5.6.10/include/m_string.h	2013-02-13 09:21:03.824647493 +0100
@@ -65,15 +65,6 @@
 extern void *(*my_str_realloc)(void *, size_t);
 extern void (*my_str_free)(void *);
 
-#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
-#define strmov(A,B) __builtin_stpcpy((A),(B))
-#elif defined(HAVE_STPCPY)
-#define strmov(A,B) stpcpy((A),(B))
-#ifndef stpcpy
-extern char *stpcpy(char *, const char *);	/* For AIX with gcc 2.95.3 */
-#endif
-#endif
-
 /* Declared in int2str() */
 extern char _dig_vec_upper[];
 extern char _dig_vec_lower[];