summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1999-09-30 11:19:16 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1999-09-30 11:19:16 (GMT)
commitfac3008e77310bb206ce85169f01426fd2124dd9 (patch)
tree8630a072e9a0a42d23b81ad9032504c7f35f1705 /Mac
parent4cc95627814d6c0fbbc973976ef2371bb66b7f7d (diff)
downloadcpython-fac3008e77310bb206ce85169f01426fd2124dd9.zip
cpython-fac3008e77310bb206ce85169f01426fd2124dd9.tar.gz
cpython-fac3008e77310bb206ce85169f01426fd2124dd9.tar.bz2
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.
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Python/macguesstabsize.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Mac/Python/macguesstabsize.c b/Mac/Python/macguesstabsize.c
index 43af884..64a6ad7 100644
--- a/Mac/Python/macguesstabsize.c
+++ b/Mac/Python/macguesstabsize.c
@@ -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);