ysulsky avatar ysulsky committed a29c917

core bigstring_marshal: don't use Obj.magic

Comments (0)

Files changed (2)

base/core/lib/bigstring_marshal.ml

   marshal_to_gen ?buf ?flags fd v ~f:(fun fd buf ~len ->
     Bigstring.really_write fd buf ~len)
 
+INCLUDE "config.mlh"
+
+IFDEF MSG_NOSIGNAL THEN
+
+let really_send_no_sigpipe = Or_error.ok_exn Bigstring.really_send_no_sigpipe
+
+let marshal_to_sock_no_sigpipe ?buf ?flags fd v =
+  marshal_to_gen ?buf ?flags fd v ~f:(fun fd buf ~len ->
+    really_send_no_sigpipe fd ?pos:None ?len:(Some len) buf)
+
+let marshal_to_sock_no_sigpipe = Ok marshal_to_sock_no_sigpipe
+
+ELSE
+
 let marshal_to_sock_no_sigpipe =
-  let f really_send_no_sigpipe
-    :  ?buf : t
-    -> ?flags : Marshal.extern_flags list
-    -> Unix.file_descr
-    -> 'a
-    -> unit
-    = fun ?buf ?flags fd v ->
-      marshal_to_gen ?buf ?flags fd v ~f:(fun fd buf ~len ->
-        really_send_no_sigpipe fd ?pos:None ?len:(Some len) buf)
-  in
-  (* Work-around for the overly-conservative value restriction *)
-  Obj.magic (Or_error.map Bigstring.really_send_no_sigpipe ~f)
+  unimplemented "Bigstring_marshal.marshal_to_sock_no_sigpipe"
 
+ENDIF

base/core/oasis.sh

 <lib{,_test}/*.ml{,i}>     : syntax_camlp4o
 "lib/backtrace.ml"         : mlh, pkg_camlp4.macro
 "lib/bigstring.ml"         : mlh, pkg_camlp4.macro
+"lib/bigstring_marshal.ml" : mlh, pkg_camlp4.macro
 "lib/core_int63.ml"        : mlh, pkg_camlp4.macro
 "lib/core_mutex.ml"        : mlh, pkg_camlp4.macro
 "lib/core_unix.ml"         : mlh, pkg_camlp4.macro
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.