mirror of https://github.com/python/cpython.git
Optimization: don't try to get a tabsize resource if we know the file
doesn't have one (stdin and such), OpenRF appears to be an expensive call.
This commit is contained in:
parent
4cc9562781
commit
fac3008e77
|
@ -45,6 +45,9 @@ guesstabsize(path)
|
|||
int refnum;
|
||||
Handle h;
|
||||
int tabsize = 0;
|
||||
|
||||
/* Very simple case: stdin (pathname empty) */
|
||||
if ( path[0] == '\0' || strcmp(path, "<stdin>") == 0 ) return 0;
|
||||
s[0] = strlen(path);
|
||||
memcpy(s+1, path, s[0]);
|
||||
refnum = OpenResFile(s);
|
||||
|
|
Loading…
Reference in New Issue