]> granicus.if.org Git - python/commitdiff
Optimization: don't try to get a tabsize resource if we know the file
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 30 Sep 1999 11:19:16 +0000 (11:19 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 30 Sep 1999 11:19:16 +0000 (11:19 +0000)
doesn't have one (stdin and such), OpenRF appears to be an expensive call.

Mac/Python/macguesstabsize.c

index 43af8845fdda8154c6e02acbdd1db0c0bc1b516e..64a6ad7c6e75e0152258d36335d14e30b1b610fb 100644 (file)
@@ -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);