-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5D6uEACgkQrlYvE4MpobNikACghbO42W/s/61JdE6c2opgTtl0 eOMAoJacXCR0mfqhBHh+IDyRBmmGHDyg =obRd -----END PGP SIGNATURE-----
>From fd7068d9b177e924e410fc33773acbe09f45cc51 Mon Sep 17 00:00:00 2001 From: Eric Paris <eparis@xxxxxxxxxx> Date: Mon, 18 Jul 2011 12:54:38 -0400 Subject: [PATCH 43/96] policycoreutils: semanage: return sooner to save CPU time Right now we do lots of needless string comparisons even though we know we are finished doing work immediately after an operation. So return sooner. Signed-off-by: Eric Paris <eparis@xxxxxxxxxx> --- policycoreutils/semanage/semanage | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-) diff --git a/policycoreutils/semanage/semanage b/policycoreutils/semanage/semanage index bcb4e7f..2896cef 100644 --- a/policycoreutils/semanage/semanage +++ b/policycoreutils/semanage/semanage @@ -239,6 +239,7 @@ Object-specific Options (see above): for o, a in gopts: if o not in option_dict[object]: sys.stderr.write(_("%s not valid for %s objects\n") % ( o, object) ); + return for o,a in gopts: if o == "-a" or o == "--add": @@ -353,50 +354,61 @@ Object-specific Options (see above): if add: if object == "login": OBJECT.add(target, seuser, serange) + return if object == "user": OBJECT.add(target, roles.split(), selevel, serange, prefix) + return if object == "port": OBJECT.add(target, proto, serange, setype) + return if object == "interface": OBJECT.add(target, serange, setype) + return if object == "node": OBJECT.add(target, mask, proto, serange, setype) + return if object == "fcontext": OBJECT.add(target, setype, ftype, serange, seuser) + return + if object == "permissive": OBJECT.add(target) + return - return - if modify: if object == "boolean": - OBJECT.modify(target, value, use_file) + OBJECT.modify(target, value, use_file) + return if object == "login": OBJECT.modify(target, seuser, serange) + return if object == "user": rlist = roles.split() OBJECT.modify(target, rlist, selevel, serange, prefix) + return if object == "port": OBJECT.modify(target, proto, serange, setype) + return if object == "interface": OBJECT.modify(target, serange, setype) + return if object == "node": OBJECT.modify(target, mask, proto, serange, setype) + return if object == "fcontext": OBJECT.modify(target, setype, ftype, serange, seuser) - - return + return if delete: if object == "port": -- 1.7.6
Attachment:
0043-policycoreutils-semanage-return-sooner-to-save-CPU-t.patch.sig
Description: PGP signature