mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
daemon: sysroot: Avoid copying the path every time we call sysroot ()
This path never changes once the daemon has started up, so we don't need to call into C code and copy the string every time.
This commit is contained in:
committed by
rwmjones
parent
1e0099671a
commit
c931ab3bc8
@@ -28,10 +28,10 @@
|
||||
|
||||
#include "daemon.h"
|
||||
|
||||
extern value guestfs_int_daemon_sysroot (value unitv);
|
||||
extern value guestfs_int_daemon_get_sysroot (value unitv);
|
||||
|
||||
value
|
||||
guestfs_int_daemon_sysroot (value unitv)
|
||||
guestfs_int_daemon_get_sysroot (value unitv)
|
||||
{
|
||||
return caml_copy_string (sysroot);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
|
||||
open Std_utils
|
||||
|
||||
external sysroot : unit -> string = "guestfs_int_daemon_sysroot"
|
||||
external get_sysroot : unit -> string = "guestfs_int_daemon_get_sysroot"
|
||||
|
||||
let sysroot = lazy (get_sysroot ())
|
||||
let sysroot () = Lazy.force sysroot
|
||||
|
||||
let sysroot_path path =
|
||||
let sysroot = sysroot () in
|
||||
|
||||
Reference in New Issue
Block a user