comparison src/strcpy.c @ 203:850242ba4a81 r20-3b28

Import from CVS: tag r20-3b28
author cvs
date Mon, 13 Aug 2007 10:02:21 +0200
parents 376386a54a3c
children 74fd4e045ea6
comparison
equal deleted inserted replaced
202:61eefc8fc970 203:850242ba4a81
22 not mapped. 22 not mapped.
23 23
24 Here are correct versions by hbs@lucid.com. 24 Here are correct versions by hbs@lucid.com.
25 */ 25 */
26 26
27 # include <config.h>
28 # ifndef REGISTER /* Strictly enforced in 20.3 */
29 # define REGISTER
30 # endif
27 31
28 #define ALIGNED(x) (!(((unsigned long) (x)) & (sizeof (unsigned long) - 1))) 32 #define ALIGNED(x) (!(((unsigned long) (x)) & (sizeof (unsigned long) - 1)))
29 33
30 #define MAGIC 0x7efefeff 34 #define MAGIC 0x7efefeff
31 #define HIGH_BIT_P(c) ((c) & hi_bit) 35 #define HIGH_BIT_P(c) ((c) & hi_bit)
32 #define HAS_ZERO(c) (((((c) + magic) ^ (c)) & not_magic) != not_magic) 36 #define HAS_ZERO(c) (((((c) + magic) ^ (c)) & not_magic) != not_magic)
33 37
38 /* CONST IS LOSING, but const is part of the interface of strcpy */
34 char * 39 char *
35 strcpy (char *to, const char *from) 40 strcpy (char *to, const char *from)
36 { 41 {
37 char *return_value = to; 42 char *return_value = to;
38 if (to == from) 43 if (to == from)
49 while ((c = *from1) != 0) 54 while ((c = *from1) != 0)
50 { 55 {
51 if (HAS_ZERO(c)) 56 if (HAS_ZERO(c))
52 { 57 {
53 to = (char *) to1; 58 to = (char *) to1;
54 from = (const char *) from1; 59 from = (CONST char *) from1;
55 goto slow_loop; 60 goto slow_loop;
56 } 61 }
57 else 62 else
58 { 63 {
59 *to1 = c; 64 *to1 = c;