Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
config.c file.c
Log Message:
Eliminate a lot of stat's during configuration file parsing.
===================================================================
RCS file: /cvs/e/e16/e/src/config.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -3 -r1.148 -r1.149
--- config.c 24 Jul 2006 21:10:58 -0000 1.148
+++ config.c 24 Jul 2006 23:56:39 -0000 1.149
@@ -395,7 +395,7 @@
lang = Mode.locale.lang;
if (!localized || !lang)
{
- if (isfile(s) && canread(s)) /* FIXME - Only one stat */
+ if (canread(s))
return Estrdup(s);
else
return NULL;
@@ -418,7 +418,7 @@
continue;
*p[i] = '\0';
- if (isfile(s) && canread(s)) /* FIXME - Only one stat */
+ if (canread(s))
return Estrdup(s);
}
===================================================================
RCS file: /cvs/e/e16/e/src/file.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -3 -r1.74 -r1.75
--- file.c 24 Jul 2006 21:10:58 -0000 1.74
+++ file.c 24 Jul 2006 23:56:39 -0000 1.75
@@ -213,27 +213,12 @@
return 0;
}
-static int
-permissions(const char *s)
-{
- struct stat st;
-
- if ((!s) || (!*s))
- return 0;
- if (stat(s, &st) < 0)
- return 0;
- return st.st_mode;
-}
-
int
canread(const char *s)
{
if ((!s) || (!*s))
return 0;
- if (!(permissions(s) & (S_IRUSR | S_IRGRP | S_IROTH)))
- return 0;
-
return 1 + access(s, R_OK);
}
@@ -243,9 +228,6 @@
if ((!s) || (!*s))
return 0;
- if (!(permissions(s) & (S_IWUSR | S_IWGRP | S_IWOTH)))
- return 0;
-
return 1 + access(s, W_OK);
}
@@ -253,9 +235,6 @@
canexec(const char *s)
{
if ((!s) || (!*s))
- return 0;
-
- if (!(permissions(s) & (S_IXUSR | S_IXGRP | S_IXOTH)))
return 0;
return 1 + access(s, X_OK);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs