Skip to content

avoid rec when called with a negative argument #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion device-usage/block/unikernel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module Main (Time : Mirage_time.S) (B : Mirage_block.S) = struct

let alloc sector_size n =
let rec loop = function
| 0 -> []
| n when (n<=0) -> []
| n ->
let page = Io_page.(to_cstruct (get 1)) in
let phrase =
Expand Down
2 changes: 1 addition & 1 deletion device-usage/console/unikernel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Lwt.Infix
module Main (C : Mirage_console.S) (Time : Mirage_time.S) = struct
let start c _time =
let rec loop = function
| 0 -> Lwt.return_unit
| n when (n<=0) -> Lwt.return_unit
| n ->
C.log c "hello" >>= fun () ->
Time.sleep_ns (Duration.of_sec 1) >>= fun () ->
Expand Down
2 changes: 1 addition & 1 deletion tutorial/hello-key/unikernel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Hello (Time : Mirage_time.S) = struct
let hello = Key_gen.hello () in

let rec loop = function
| 0 -> Lwt.return_unit
| n when (n<=0) -> Lwt.return_unit
| n ->
Logs.info (fun f -> f "%s" hello);
Time.sleep_ns (Duration.of_sec 1) >>= fun () -> loop (n - 1)
Expand Down
2 changes: 1 addition & 1 deletion tutorial/hello/unikernel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Lwt.Infix
module Hello (Time : Mirage_time.S) = struct
let start _time =
let rec loop = function
| 0 -> Lwt.return_unit
| n when (n<=0) -> Lwt.return_unit
| n ->
Logs.info (fun f -> f "hello");
Time.sleep_ns (Duration.of_sec 1) >>= fun () -> loop (n - 1)
Expand Down
2 changes: 1 addition & 1 deletion tutorial/lwt/echo_server/unikernel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct

let start c _time _r =
let rec echo_server = function
| 0 -> Lwt.return ()
| n when (n<=0) -> Lwt.return ()
| n ->
read_line () >>= fun s ->
C.log c s >>= fun () -> echo_server (n - 1)
Expand Down