All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise
@ 2018-10-30 10:17 Christian Lindig
  2018-10-30 16:50 ` Ian Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Lindig @ 2018-10-30 10:17 UTC (permalink / raw)
  To: xen-devel; +Cc: Christian Lindig

The type of Xsraw.sync is made more precise:

from val sync : (Xenbus.Xb.t -> 'a) -> con -> string
to   val sync : (Xenbus.Xb.t -> unit) -> con -> string

The first argument is enforced to return unit rather than a value that
is not used anyway.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xs/xsraw.mli    | 2 +-
 tools/ocaml/xenstored/process.ml | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/libs/xs/xsraw.mli b/tools/ocaml/libs/xs/xsraw.mli
index 57e4fb0c90..374f0f9fad 100644
--- a/tools/ocaml/libs/xs/xsraw.mli
+++ b/tools/ocaml/libs/xs/xsraw.mli
@@ -33,7 +33,7 @@ val has_watchevents : con -> bool
 val get_watchevent : con -> string * string
 val read_watchevent : con -> string * string
 val sync_recv : Xenbus.Xb.Op.operation -> con -> string
-val sync : (Xenbus.Xb.t -> 'a) -> con -> string
+val sync : (Xenbus.Xb.t -> unit) -> con -> string
 val ack : string -> unit
 val validate_path : string -> unit
 val validate_watch_path : string -> unit
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 977e7c11be..d813d7fd50 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -348,7 +348,7 @@ let transaction_replay c t doms cons =
 				false
 			)
 		(fun () ->
-			Connection.end_transaction c tid None
+			ignore @@ Connection.end_transaction c tid None
 		)
 
 let do_watch con t domains cons data =
@@ -366,7 +366,7 @@ let do_unwatch con t domains cons data =
 		| [node; token; ""]   -> node, token
 		| _                   -> raise Invalid_Cmd_Args
 		in
-	Connections.del_watch cons con node token
+	ignore @@ Connections.del_watch cons con node token
 
 let do_transaction_start con t domains cons data =
 	if Transaction.get_id t <> Transaction.none then
-- 
2.19.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise
  2018-10-30 10:17 [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise Christian Lindig
@ 2018-10-30 16:50 ` Ian Jackson
  2018-10-30 16:52   ` Christian Lindig
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Jackson @ 2018-10-30 16:50 UTC (permalink / raw)
  To: Christian Lindig; +Cc: xen-devel

Christian Lindig writes ("[Xen-devel] [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise"):
> The type of Xsraw.sync is made more precise:
> 
> from val sync : (Xenbus.Xb.t -> 'a) -> con -> string
> to   val sync : (Xenbus.Xb.t -> unit) -> con -> string
> 
> The first argument is enforced to return unit rather than a value that
> is not used anyway.

I'm not much of an ocaml programmer but this seems like it has no
overall functional change ?

I take it that ignore is the trivial function with type ('a -> unit).

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise
  2018-10-30 16:50 ` Ian Jackson
@ 2018-10-30 16:52   ` Christian Lindig
  2018-10-30 16:59     ` Ian Jackson
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Lindig @ 2018-10-30 16:52 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel



> On 30 Oct 2018, at 16:50, Ian Jackson <ian.jackson@citrix.com> wrote:
> 
> I'm not much of an ocaml programmer but this seems like it has no
> overall functional change ?
> 
> I take it that ignore is the trivial function with type ('a -> unit).

That is correct. Except that types now reflect more accurately what is happening. I discovered this when compiling the libraries with another build system and the compiler complained about this.

— C


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise
  2018-10-30 16:52   ` Christian Lindig
@ 2018-10-30 16:59     ` Ian Jackson
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Jackson @ 2018-10-30 16:59 UTC (permalink / raw)
  To: Christian Lindig; +Cc: xen-devel, Wei Liu

Christian Lindig writes ("Re: [Xen-devel] [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise"):
> > On 30 Oct 2018, at 16:50, Ian Jackson <ian.jackson@citrix.com> wrote:
> > I'm not much of an ocaml programmer but this seems like it has no
> > overall functional change ?
> > 
> > I take it that ignore is the trivial function with type ('a -> unit).
> 
> That is correct. Except that types now reflect more accurately what is happening. I discovered this when compiling the libraries with another build system and the compiler complained about this.

Great.  How useful of it.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

FTR I find it helpful to mention in the commit message when a commit
has no functional change.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-30 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 10:17 [PATCH 1/1] tools/ocaml: make type of Xsraw.sync more precise Christian Lindig
2018-10-30 16:50 ` Ian Jackson
2018-10-30 16:52   ` Christian Lindig
2018-10-30 16:59     ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.