From 6b132f243ebc90061a31745628c6174c8dc747f0 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 16 Feb 2023 15:59:20 +0100 Subject: [PATCH] Print duplicated value on error --- src/emu/chan.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/emu/chan.c b/src/emu/chan.c index 40fe8a8..9d01d5d 100644 --- a/src/emu/chan.c +++ b/src/emu/chan.c @@ -71,7 +71,9 @@ check_duplicates(struct chan *chan, struct value *v) return 0; if (value_is_equal(&chan->last_value, v)) { - err("%s: same value as last_value", chan->name); + char buf[128]; + err("%s: same value as last_value %s", + chan->name, value_str(chan->last_value, buf)); return -1; } @@ -92,13 +94,13 @@ chan_set(struct chan *chan, struct value value) } if (check_duplicates(chan, &value) != 0) { - err("%s: cannot set a duplicated value", chan->name); + err("%s: cannot set duplicated value", chan->name); return -1; } char buf[128]; UNUSED(buf); - dbg("chan_set %s: sets value to %s\n", + dbg("%s: sets value to %s\n", chan->name, value_str(value, buf)); chan->data.value = value;