فهرست منبع

don't allocate so much

Simon Krajewski 5 سال پیش
والد
کامیت
7cd7425a1e
2فایلهای تغییر یافته به همراه5 افزوده شده و 9 حذف شده
  1. 3 3
      libs/uv/uv.ml
  2. 2 6
      libs/uv/uv_stubs.c

+ 3 - 3
libs/uv/uv.ml

@@ -247,7 +247,7 @@ external pipe_accept_pending : t_loop -> t_pipe -> pipe_accepted uv_result = "w_
 external pipe_getsockname : t_pipe -> string uv_result = "w_pipe_getsockname"
 external pipe_getpeername : t_pipe -> string uv_result = "w_pipe_getpeername"
 
-(* ------------- MUTEXES ---------------------------------------------- *)
+(* ------------- MUTEXES -------------------------------------------- *)
 
 type t_mutex
 
@@ -256,7 +256,7 @@ external mutex_lock : t_mutex -> unit = "w_mutex_lock"
 external mutex_trylock : t_mutex -> unit uv_result = "w_mutex_trylock"
 external mutex_unlock : t_mutex -> unit = "w_mutex_unlock"
 
-(* ------------- TLS ---------------------------------------------- *)
+(* ------------- TLS ------------------------------------------------ *)
 
 type t_key
 
@@ -265,7 +265,7 @@ external key_delete : t_key -> unit = "w_key_delete"
 external key_get : t_key -> 'a = "w_key_get"
 external key_set : t_key -> 'a -> unit = "w_key_set"
 
-(* ------------- HAXE ---------------------------------------------- *)
+(* ------------- HAXE ----------------------------------------------- *)
 
 external get_file_open_flags : unit -> (string * int) array = "hx_get_file_open_flags"
 external get_errno : unit -> (string * int) array = "hx_get_errno"

+ 2 - 6
libs/uv/uv_stubs.c

@@ -1232,14 +1232,12 @@ CAMLprim value w_pipe_write_handle(value handle, value data, value send_handle,
 	UV_SUCCESS_UNIT;
 }
 
-// ------------- MUTEXES -----------------------------------------------
+// ------------- MUTEXES --------------------------------------------
 
 CAMLprim value w_mutex_init(value unit) {
 	CAMLparam1(unit);
 	UV_ALLOC_CHECK(handle, uv_mutex_t);
 	UV_ERROR_CHECK_C(uv_mutex_init(Mutex_val(handle)), free(Mutex_val(handle)));
-	if ((UV_HANDLE_DATA(Mutex_val(handle)) = alloc_data()) == NULL)
-		UV_ERROR(0);
 	UV_SUCCESS(handle);
 }
 
@@ -1261,14 +1259,12 @@ CAMLprim value w_mutex_unlock(value handle) {
 	UV_SUCCESS_UNIT;
 }
 
-// ------------- TLS -----------------------------------------------
+// ------------- TLS ------------------------------------------------
 
 CAMLprim value w_key_create(value unit) {
 	CAMLparam1(unit);
 	UV_ALLOC_CHECK(handle, uv_key_t);
 	UV_ERROR_CHECK_C(uv_key_create(Key_val(handle)), free(Key_val(handle)));
-	if ((UV_HANDLE_DATA(Key_val(handle)) = alloc_data()) == NULL)
-		UV_ERROR(0);
 	UV_SUCCESS(handle);
 }