From: "Richard W.M. Jones" <rjones(a)redhat.com>
Avoids GC overhead and turns these into simple C calls. See:
http://camltastic.blogspot.co.uk/2008/08/tip-calling-c-functions-directly...
(cherry picked from commit 67fd809ca3ec711d80e69ab32646899e7ca047eb)
(cherry picked from commit 28049a4df751a954674439368788d5b7723e2c5c)
---
resize/progress-c.c | 8 ++++----
resize/progress.ml | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/resize/progress-c.c b/resize/progress-c.c
index 67913eb..6d777b6 100644
--- a/resize/progress-c.c
+++ b/resize/progress-c.c
@@ -80,27 +80,27 @@ virt_resize_progress_bar_init (value machine_readablev)
CAMLreturn (barv);
}
+/* NB: "noalloc" function. */
value
virt_resize_progress_bar_reset (value barv)
{
- CAMLparam1 (barv);
struct progress_bar *bar = Bar_val (barv);
progress_bar_reset (bar);
- CAMLreturn (Val_unit);
+ return Val_unit;
}
+/* NB: "noalloc" function. */
value
virt_resize_progress_bar_set (value barv,
value positionv, value totalv)
{
- CAMLparam3 (barv, positionv, totalv);
struct progress_bar *bar = Bar_val (barv);
uint64_t position = Int64_val (positionv);
uint64_t total = Int64_val (totalv);
progress_bar_set (bar, position, total);
- CAMLreturn (Val_unit);
+ return Val_unit;
}
diff --git a/resize/progress.ml b/resize/progress.ml
index e53e693..194120e 100644
--- a/resize/progress.ml
+++ b/resize/progress.ml
@@ -25,9 +25,9 @@ type progress_bar
external progress_bar_init : machine_readable:bool -> progress_bar
= "virt_resize_progress_bar_init"
external progress_bar_reset : progress_bar -> unit
- = "virt_resize_progress_bar_reset"
+ = "virt_resize_progress_bar_reset" "noalloc"
external progress_bar_set : progress_bar -> int64 -> int64 -> unit
- = "virt_resize_progress_bar_set"
+ = "virt_resize_progress_bar_set" "noalloc"
let set_up_progress_bar ?(machine_readable = false) (g : Guestfs.guestfs) =
(* Only display progress bars if the machine_readable flag is set or
--
1.8.3.1