[augeas-devel] augeas: master - Logrotate (hooks): simplify to speed up typechecker

David Lutterkort lutter at fedoraproject.org
Fri Jun 5 20:13:24 UTC 2009


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=aa2763a1772cd30a9651812fcce8030e187e208c
Commit:        aa2763a1772cd30a9651812fcce8030e187e208c
Parent:        5d8e7d90b4f24330264e8194272149c0c01b266d
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Fri Jun 5 13:12:18 2009 -0700
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Fri Jun 5 13:12:18 2009 -0700

Logrotate (hooks): simplify to speed up typechecker

---
 lenses/logrotate.aug |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/lenses/logrotate.aug b/lenses/logrotate.aug
index 2a4b461..6663cde 100644
--- a/lenses/logrotate.aug
+++ b/lenses/logrotate.aug
@@ -85,16 +85,12 @@ module Logrotate =
      let line_re = /.*/ - /[ \t]*endscript[ \t]*/ in
        store ( line_re . ("\n" . line_re)* )? . del "\n" "\n"
 
-   let hook_func (func_type:string) = [
-       del /[ \t]*/ "\t" . key func_type . eol .
+   let hooks =
+     let hook_names = /(pre|post)rotate|(first|last)action/ in
+     [ del /[ \t]*/ "\t" . key hook_names . eol .
        hook_lines .
        del /[ \t]*endscript\n/ "\tendscript\n" ]
 
-   let hooks = hook_func "postrotate"
-             | hook_func "prerotate"
-             | hook_func "firstaction"
-             | hook_func "lastaction"
-
    (* Define rule *)
 
    let body = del /\{[ \t]*\n/ "{\n"




More information about the augeas-devel mailing list