comparison src/strcpy.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
33 33
34 #define MAGIC 0x7efefeff 34 #define MAGIC 0x7efefeff
35 #define HIGH_BIT_P(c) ((c) & hi_bit) 35 #define HIGH_BIT_P(c) ((c) & hi_bit)
36 #define HAS_ZERO(c) (((((c) + magic) ^ (c)) & not_magic) != not_magic) 36 #define HAS_ZERO(c) (((((c) + magic) ^ (c)) & not_magic) != not_magic)
37 37
38 /* CONST IS LOSING, but const is part of the interface of strcpy */
38 char * 39 char *
39 strcpy (char *to, const char *from) 40 strcpy (char *to, const char *from)
40 { 41 {
41 char *return_value = to; 42 char *return_value = to;
42 if (to == from) 43 if (to == from)
53 while ((c = *from1) != 0) 54 while ((c = *from1) != 0)
54 { 55 {
55 if (HAS_ZERO(c)) 56 if (HAS_ZERO(c))
56 { 57 {
57 to = (char *) to1; 58 to = (char *) to1;
58 from = (const char *) from1; 59 from = (CONST char *) from1;
59 goto slow_loop; 60 goto slow_loop;
60 } 61 }
61 else 62 else
62 { 63 {
63 *to1 = c; 64 *to1 = c;