From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRT0a-0007NN-IU for qemu-devel@nongnu.org; Thu, 04 Feb 2016 18:08:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRT0X-0005OZ-DO for qemu-devel@nongnu.org; Thu, 04 Feb 2016 18:08:16 -0500 Received: from mail-qg0-x243.google.com ([2607:f8b0:400d:c04::243]:33125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRT0X-0005OV-8i for qemu-devel@nongnu.org; Thu, 04 Feb 2016 18:08:13 -0500 Received: by mail-qg0-x243.google.com with SMTP id o11so3407194qge.0 for ; Thu, 04 Feb 2016 15:08:13 -0800 (PST) Sender: Richard Henderson References: <1454597781-18115-1-git-send-email-alex.bennee@linaro.org> <1454597781-18115-7-git-send-email-alex.bennee@linaro.org> From: Richard Henderson Message-ID: <56B3D9D6.2040600@twiddle.net> Date: Fri, 5 Feb 2016 10:08:06 +1100 MIME-Version: 1.0 In-Reply-To: <1454597781-18115-7-git-send-email-alex.bennee@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v5 6/9] qemu-log: new option -dfilter to limit output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, crosthwaitepeter@gmail.com, dgilbert@redhat.com, aurelien@aurel32.net, peter.maydell@linaro.org On 02/05/2016 01:56 AM, Alex Bennée wrote: > + gchar *range_op = g_strstr_len(r, -1, "-"); This is strchr. > + range_op = g_strstr_len(r, -1, "."); Or at least if you're going to make use of strstr, search for "..". > + g_strdelimit(range_val, ".", ' '); Cause this is just weird. It accepts "1+.2" just the same as "1..2". > + err = qemu_strtoul(r, NULL, 0, &range.begin); This should be strtoull. You probably broke 32-bit compilation here. > + case '+': > + { > + unsigned long len; > + err |= qemu_strtoul(range_val, NULL, 0, &len); > + range.end = range.begin + len; > + break; > + } > + case '-': > + { > + unsigned long len; > + err |= qemu_strtoul(range_val, NULL, 0, &len); > + range.end = range.begin; > + range.begin = range.end - len; > + break; > + } Both of these have off-by-one bugs, since end is inclusive. > + case '.': > + err |= qemu_strtoul(range_val, NULL, 0, &range.end); > + break; I'd think multiple dot detection belongs here, and you need not smash them to ' ' but merely notice that there are two of them and then strtoull range_val+1. r~