Mercurial > cpython-lru_cache-weakref
annotate Python/memmove.c @ 16357:9f2ca855fa44 legacy-trunk
Enforce two illegal import statements that were outlawed in the
reference manual but not checked: Names bound by import statemants may
not occur in global statements in the same scope. The from ... import *
form may only occur in a module scope.
I guess these changes could break code, but the reference manual
warned about them.
Several other small changes
If a variable is declared global in the nearest enclosing scope of a
free variable, then treat it is a global in the nested scope too.
Get rid of com_mangle and symtable_mangle functions and call mangle
directly.
If errors occur during symtable table creation, return -1 from
symtable_build().
Do not increment st_errors in assignment to lambda, because exception
is not set.
Add extra argument to symtable_assign(); the argument, flag, is ORed
with DEF_LOCAL for each symtable_add_def() call.
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Tue, 30 Jan 2001 01:24:43 +0000 |
| parents | 6f6f965c5e2d |
| children |
| rev | line source |
|---|---|
| 1449 | 1 |
| 2 /* A perhaps slow but I hope correct implementation of memmove */ | |
| 3 | |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
4 extern char *memcpy(char *, char *, int); |
| 1449 | 5 |
| 6 char * | |
|
13658
f79434ee41fa
Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents:
13256
diff
changeset
|
7 memmove(char *dst, char *src, int n) |
| 1449 | 8 { |
| 9 char *realdst = dst; | |
| 10 if (n <= 0) | |
| 11 return dst; | |
| 12 if (src >= dst+n || dst >= src+n) | |
| 13 return memcpy(dst, src, n); | |
| 14 if (src > dst) { | |
| 15 while (--n >= 0) | |
| 16 *dst++ = *src++; | |
| 17 } | |
| 18 else if (src < dst) { | |
| 19 src += n; | |
| 20 dst += n; | |
| 21 while (--n >= 0) | |
| 22 *--dst = *--src; | |
| 23 } | |
| 24 return realdst; | |
| 25 } |
