Skip to content
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

removed the unnecessary "ugly cast" from function add_cancel_callback #844

Merged
merged 3 commits into from
Jul 24, 2021
Merged
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
16 changes: 12 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
===== dev =====

====== Additions ======

* Lwt_seq: a Seq-like data-structure with Lwt delayed nodes (#836, #842, Zach Shipko).

====== Misc ======

* Code quality improvement: remove an uneeded Obj.magic (#844, Benoit Montagu).


===== 5.4.1 =====

====== Bugs fixed ======
Expand All @@ -10,16 +21,13 @@



====== Additions ======

* Lwt_seq: a Seq-like data-structure with Lwt delayed nodes (#836, Zach Shipko).

====== Bugfixes ======

* Fix Lwt_fmt.stderr to actually point to stderr (#852, #850, Volker Diels-Grabsch).

* Lwt_io.establish_server* handles ECONNABORTED (#829, #830, Reynir Björnsson)


===== 5.4.0 (2020-12-16) =====

====== Installability ======
Expand Down
8 changes: 2 additions & 6 deletions src/core/lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,8 @@ sig
val add_explicitly_removable_callback_to_each_of :
'a t list -> 'a regular_callback -> unit
val add_explicitly_removable_callback_and_give_remove_function :
'a t list -> 'a regular_callback -> (unit -> unit)
val add_cancel_callback : 'a callbacks -> (unit -> unit) -> unit
'a t list -> 'a regular_callback -> cancel_callback
val add_cancel_callback : 'a callbacks -> cancel_callback -> unit
val merge_callbacks : from:'a callbacks -> into:'a callbacks -> unit
end =
struct
Expand Down Expand Up @@ -1004,10 +1004,6 @@ struct
clear_explicitly_removable_callback_cell cell ~originally_added_to:ps

let add_cancel_callback callbacks f =
(* Ugly cast :( *)
let cast_cancel_callback : (unit -> unit) -> cancel_callback = Obj.magic in
let f = cast_cancel_callback f in

let node = Cancel_callback_list_callback (!current_storage, f) in

callbacks.cancel_callbacks <-
Expand Down