|
|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/I+/8ACgkQrlYvE4MpobOwKQCgsLKH/MsX9f1vUi+YHHDdp3Ss qaIAoNdvd2qRVzkZK+jhlssF3qT9UFLo =ZSiY -----END PGP SIGNATURE-----
>From 7b2d68112278f4ce85944c6b65470277de46f420 Mon Sep 17 00:00:00 2001
From: Adam Tkac <atkac@xxxxxxxxxx>
Date: Fri, 25 May 2012 17:42:08 +0200
Subject: [PATCH 81/90] Optimize expand_filename_trans() function, part1.
Currently expand_filename_trans() function use much CPU time to find
end of the state->out->filename_trans list. This is not needed because
data can be prepended instead of appended to the list.
This ends with 10% speed-up of various se* commands (semodule, setsebool).
Signed-off-by: Adam Tkac <atkac@xxxxxxxxxx>
Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
libsepol/src/expand.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
index 0c05465..bef759c 100644
--- a/libsepol/src/expand.c
+++ b/libsepol/src/expand.c
@@ -1352,16 +1352,11 @@ static int copy_role_trans(expand_state_t * state, role_trans_rule_t * rules)
static int expand_filename_trans(expand_state_t *state, filename_trans_rule_t *rules)
{
unsigned int i, j;
- filename_trans_t *new_trans, *tail, *cur_trans;
+ filename_trans_t *new_trans, *cur_trans;
filename_trans_rule_t *cur_rule;
ebitmap_t stypes, ttypes;
ebitmap_node_t *snode, *tnode;
- /* start at the end of the list */
- tail = state->out->filename_trans;
- while (tail && tail->next)
- tail = tail->next;
-
cur_rule = rules;
while (cur_rule) {
uint32_t mapped_otype;
@@ -1422,11 +1417,8 @@ static int expand_filename_trans(expand_state_t *state, filename_trans_rule_t *r
return -1;
}
memset(new_trans, 0, sizeof(*new_trans));
- if (tail)
- tail->next = new_trans;
- else
- state->out->filename_trans = new_trans;
- tail = new_trans;
+ new_trans->next = state->out->filename_trans;
+ state->out->filename_trans = new_trans;
new_trans->name = strdup(cur_rule->name);
if (!new_trans->name) {
--
1.7.10.2
[Fedora Users] [Fedora Legacy] [Fedora Desktop] [Yosemite Photos] [Yosemite News] [Yosemite Campsites] [KDE Users] [Gnome Users]