annotate Python/strdup.c @ 66978:aed2bbafa550 3.1

Blocked revisions 87324 via svnmerge ........ r87324 | r.david.murray | 2010-12-16 14:08:51 -0500 (Thu, 16 Dec 2010) | 9 lines #10719: restore messages generated on invalid compileall args Before the introduction of filename arguments to compileall it gave semi useful messages about not being able to 'list' names that weren't valid directories. This fix restores that behavior. In addition to the test for this case, the patch also adds a test for the default behavior of compileall when no arguments are provided, and fixes a bug in one of the previously added tests. ........
author R. David Murray <rdmurray@bitdance.com>
date Thu, 16 Dec 2010 19:10:16 +0000
parents f79434ee41fa
children e7f6cef7a4cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4174
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 /* strdup() replacement (from stdwin, if you must know) */
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
9970
8efa37a770c6 Patches by William Lewis for Nextstep descendants.
Guido van Rossum <guido@python.org>
parents: 4175
diff changeset
3 #include "pgenheaders.h"
4174
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 char *
13658
f79434ee41fa Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents: 9970
diff changeset
6 strdup(const char *str)
4174
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 {
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 if (str != NULL) {
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 register char *copy = malloc(strlen(str) + 1);
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 if (copy != NULL)
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 return strcpy(copy, str);
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 }
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 return NULL;
d241bfda7b74 *** empty log message ***
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 }