[Python-checkins] r85707 - python/branches/pep-382/Python/import.c
barry.warsaw
python-checkins at python.org
Tue Oct 19 01:32:03 CEST 2010
Author: barry.warsaw
Date: Tue Oct 19 01:32:01 2010
New Revision: 85707
Log:
A Windows compatible take on the previous patch (Jason Coombs)
Modified:
python/branches/pep-382/Python/import.c
Modified: python/branches/pep-382/Python/import.c
==============================================================================
--- python/branches/pep-382/Python/import.c (original)
+++ python/branches/pep-382/Python/import.c Tue Oct 19 01:32:01 2010
@@ -2469,10 +2469,14 @@
find_pth_files(char *buf, size_t buflen, PyObject **p_result)
{
#if defined(MS_WINDOWS)
- PyObject *result = *p_result = NULL;
+ PyObject *result = NULL;
size_t dirlen = strlen(buf);
WIN32_FIND_DATAA data;
HANDLE hFindFile;
+
+ if (p_result != NULL) {
+ *p_result = NULL;
+ }
if (dirlen + 6 > buflen)
/* claim that nothing was found */
@@ -2497,16 +2501,15 @@
}
}
FindClose(hFindFile);
- *p_result = result;
+ if (p_result != NULL) {
+ *p_result = result;
+ }
return 1;
#elif defined(HAVE_DIRENT_H)
/* XXX begin/end allow threads */
/* XXX caseok */
PyObject *result = NULL;
int dirlen = strlen(buf);
- if (p_result != NULL) {
- *p_result = NULL;
- }
DIR *dirp = opendir(buf);
while(1) {
struct dirent *entry = readdir(dirp);
@@ -2530,7 +2533,7 @@
}
}
}
- if (p_result != NULL ) {
+ if (p_result != NULL) {
*p_result = result;
}
closedir(dirp);
More information about the Python-checkins
mailing list