From 6c8e1d625c4b4adba5ea03f615d79b38b6a5fdd0 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Wed, 14 Feb 2007 15:47:51 +0000 Subject: [PATCH] (Fcolor_distance): Don't continue checking a color for errors after it has been correctly parsed as an RGB list. --- src/xfaces.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/xfaces.c b/src/xfaces.c index 46a95feeb45..b98d10764ce 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5348,13 +5348,11 @@ If FRAME is unspecified or nil, the current frame is used. */) CHECK_LIVE_FRAME (frame); f = XFRAME (frame); - if ((CONSP (color1) && !parse_rgb_list (color1, &cdef1)) - || !STRINGP (color1) - || !defined_color (f, SDATA (color1), &cdef1, 0)) + if (!(CONSP (color1) && parse_rgb_list (color1, &cdef1)) + && !(STRINGP (color1) && defined_color (f, SDATA (color1), &cdef1, 0))) signal_error ("Invalid color", color1); - if ((CONSP (color2) && !parse_rgb_list (color2, &cdef2)) - || !STRINGP (color2) - || !defined_color (f, SDATA (color2), &cdef2, 0)) + if (!(CONSP (color2) && parse_rgb_list (color2, &cdef2)) + && !(STRINGP (color2) && defined_color (f, SDATA (color2), &cdef2, 0))) signal_error ("Invalid color", color2); return make_number (color_distance (&cdef1, &cdef2)); -- 2.39.2