Reduce overhead by leaving rc_deptree_update_needed() as soon as possible

There's no need to check any further if we're returning true anyway.

Signed-off-by: Christian Ruppert <idl0r@gentoo.org>
This commit is contained in:
Christian Ruppert 2012-04-26 12:40:13 +02:00
parent fd6bbfbe07
commit 441272ff97

View File

@ -687,27 +687,27 @@ rc_deptree_update_needed(time_t *newest, char *file)
if (!existss(RC_DEPTREE_CACHE)) if (!existss(RC_DEPTREE_CACHE))
return true; return true;
if (!rc_newer_than(RC_DEPTREE_CACHE, RC_INITDIR, newest, file)) if (!rc_newer_than(RC_DEPTREE_CACHE, RC_INITDIR, newest, file))
newer = true; return true;
if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONFDIR, newest, file)) if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONFDIR, newest, file))
newer = true; return true;
#ifdef RC_PKG_INITDIR #ifdef RC_PKG_INITDIR
if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_INITDIR, newest, file)) if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_INITDIR, newest, file))
newer = true; return true;
#endif #endif
#ifdef RC_PKG_CONFDIR #ifdef RC_PKG_CONFDIR
if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_CONFDIR, newest, file)) if (!rc_newer_than(RC_DEPTREE_CACHE, RC_PKG_CONFDIR, newest, file))
newer = true; return true;
#endif #endif
#ifdef RC_LOCAL_INITDIR #ifdef RC_LOCAL_INITDIR
if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_INITDIR, newest, file)) if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_INITDIR, newest, file))
newer = true; return true;
#endif #endif
#ifdef RC_LOCAL_CONFDIR #ifdef RC_LOCAL_CONFDIR
if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_CONFDIR, newest, file)) if (!rc_newer_than(RC_DEPTREE_CACHE, RC_LOCAL_CONFDIR, newest, file))
newer = true; return true;
#endif #endif
if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONF, newest, file)) if (!rc_newer_than(RC_DEPTREE_CACHE, RC_CONF, newest, file))
newer = true; return true;
/* Some init scripts dependencies change depending on config files /* Some init scripts dependencies change depending on config files
* outside of baselayout, like syslog-ng, so we check those too. */ * outside of baselayout, like syslog-ng, so we check those too. */
@ -715,8 +715,7 @@ rc_deptree_update_needed(time_t *newest, char *file)
TAILQ_FOREACH(s, config, entries) { TAILQ_FOREACH(s, config, entries) {
if (!rc_newer_than(RC_DEPTREE_CACHE, s->value, newest, file)) { if (!rc_newer_than(RC_DEPTREE_CACHE, s->value, newest, file)) {
newer = true; newer = true;
if (newest == NULL) break;
break;
} }
} }
rc_stringlist_free(config); rc_stringlist_free(config);