[Pkg-libvirt-commits] [libguestfs] 01/26: firstboot: Factor out regular expression constant.

Hilko Bengen bengen at moszumanska.debian.org
Sun Nov 1 17:11:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag upstream/1.28.12
in repository libguestfs.

commit 63b0b18b1e0d2d2c2dbcbb6ff8ea391d49aa3fcb
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Mon Apr 27 15:02:30 2015 +0100

    firstboot: Factor out regular expression constant.
    
    Don't need to evaluate this every time we call the function.
    
    (cherry picked from commit aa8d66e7559bb8b0d7112c863ed85f02319e92e5)
---
 customize/firstboot.ml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/customize/firstboot.ml b/customize/firstboot.ml
index d7b96a6..2fe2dfc 100644
--- a/customize/firstboot.ml
+++ b/customize/firstboot.ml
@@ -27,8 +27,10 @@ open Regedit
 let unix2dos s =
   String.concat "\r\n" (Str.split_delim (Str.regexp_string "\n") s)
 
-let sanitize_name n =
-  Str.global_replace (Str.regexp "[^A-Za-z0-9_]") "-" n
+let sanitize_name =
+  let rex = Str.regexp "[^A-Za-z0-9_]" in
+  fun n ->
+    Str.global_replace rex "-" n
 
 (* For Linux guests. *)
 module Linux = struct

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list