Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3379805pxk; Mon, 21 Sep 2020 12:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeCp63lr6S4i9NSwXXGauoHb6zrHZIAbAyXmVgO0tLrwT+XFm6tGbpSxMLqBErSSm6/Tlk X-Received: by 2002:aa7:cd5a:: with SMTP id v26mr398948edw.38.1600715169186; Mon, 21 Sep 2020 12:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600715169; cv=none; d=google.com; s=arc-20160816; b=UhB+4OGZHG3fQ9ZMYixFqE7gjHEwrbZLMxnTB4rddMxJV62RRJB/gwbsiclvHgK5XX nvspCXg5bkmtjLS8ZaGM6pKIvYf/0x5eY85yaFZOE2fdymCY7RFWreOIZLwXRTIcj6l/ vl6WzhytebU1YSjOfhMS7OZFmR6jV9P5E90xKYg/KRnI+WozbK3VZTkGPS5rQ1+arXH3 8UrhwCtlCEhILMHvCgbvEIVDbAW94pmeT7lztqzdrcL6mJ1QPp4unAj7jpTXVJAxrhlo jC79VsbceW5+4D6KjtS4ObJKuxKgSqtocUD2VmQCV/dYT3Sb3u1nVc1kXp1T1ruNgU2J 4S5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZaMWZkyD8w8bty+lVoe4etb5iUiplZyQSMlVzME0xz8=; b=U2G1+YNdT8F1lk7T3Q+rbIoBJYGNCM53g/CMze0NKM5pshYXY1ro9lksQ0Wdc4eAb8 4PPezSicpXl0au53leSHj2N8l1m6s5VVVBHHuiK1jKfnEcDIO/vCN3aZcrddAD1bP6Mg Mz5pVT+Q7WeBR4IPVeDRiGdGAfU0NjeTo6UoUh8llRsgBSxbMqpPJKAeIGEgQ3SrJB8V ho3H209miBgMHP/CaelIK6Vo9VdO+izDxE5E3PqIa7SOVgZaobm2NwiaPHxNDV+x0tUx bzpUx3Mv5r/m50nYBNXSCB6rnFneGRl6bFMudMAHz4taxI8hBZQD9MaSJE1zGI4Z2qpW 4dOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KskV0v9U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si5868388ejx.264.2020.09.21.12.05.45; Mon, 21 Sep 2020 12:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KskV0v9U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727931AbgIUTEo (ORCPT + 99 others); Mon, 21 Sep 2020 15:04:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727782AbgIUTEo (ORCPT ); Mon, 21 Sep 2020 15:04:44 -0400 Received: from mail-oo1-xc44.google.com (mail-oo1-xc44.google.com [IPv6:2607:f8b0:4864:20::c44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E2C6C061755 for ; Mon, 21 Sep 2020 12:04:44 -0700 (PDT) Received: by mail-oo1-xc44.google.com with SMTP id k13so3532975oor.2 for ; Mon, 21 Sep 2020 12:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZaMWZkyD8w8bty+lVoe4etb5iUiplZyQSMlVzME0xz8=; b=KskV0v9UTZuxKjXqc4/UbAuDGOEFQvjHrt2gHad4619sJ6hEy6/AVasy83fo+yUTLr Vb4P0E1nO73lfv96wxu0eudAtcsEXNAU1J0HtlyOKWvzhBA1poIfvjN3CJWdWb53Lw/7 Jw+TSmXUqyRSTPnqdDvndx3VYaYwBPtgoqAOw1Bdulr8wQwzVJMReW3bI13qIBxXHfz6 rHT6cobNqvEfvASZcLrbzRWIz2cRJfU2uRXRDegkjn1mSvjLXlXiGz0aGiCWyi9Przsq N02SkG/3m5Rxx2WO5SZ89R705tyYOtW/BgfAS9XhvsyYtRMMLLpLASULhR+IHyFTMB9v ztVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZaMWZkyD8w8bty+lVoe4etb5iUiplZyQSMlVzME0xz8=; b=nfcxijUWsNrDI7PNqDrFFoxjMtgzIEYN79rU1eXJHBsfxhTxCHAP09S3T3c6ZmHXdH GXfoVyTzLwWcvAgTcpjNCtqOjqgXD8iYW+zfduYiWymWaiA+5BsUmFEMIdT41/zGK7My mp4Cio6V1emHKDBwetIWpfceY5RJpBQqQRIwR7ekucTTE3gYtUs+1AwYTJTR2zUj1ZrU 55Dz3YQZkmq+SL6GDVFLG0mI2r96Ib3oP+D7JrNsjTtCra5fZD/Rbhxg0wqo0zXZayb3 MGpDStTOjaytyPF9iGaHysTOzbMjYS6x2fnbm+OonEbBHMffWIjVSf6cij6W2Xp+Mbj3 DH0g== X-Gm-Message-State: AOAM530HKKCQX28OEAW5KMdY3549xHxE+g3FwxAIzcTeXkLJsWDahlCU VnJ8jZ4XQoPao7jsNyv6nhE36as/UuhuMA== X-Received: by 2002:a4a:ad05:: with SMTP id r5mr548487oon.37.1600715083420; Mon, 21 Sep 2020 12:04:43 -0700 (PDT) Received: from frodo.comcast.net ([2601:284:8203:5970::2931]) by smtp.googlemail.com with ESMTPSA id f1sm7426493ooq.12.2020.09.21.12.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Sep 2020 12:04:42 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [PATCH 2/2] dyndbg: use keyword, arg varnames for query term pairs Date: Mon, 21 Sep 2020 13:04:33 -0600 Message-Id: <20200921190433.1149521-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200921190433.1149521-1-jim.cromie@gmail.com> References: <20200921190433.1149521-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org optimize for clarity by replacing word[i,i+1] refs with temps. no functional changes. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 90ddf07ce34fe..23e7dd967b0e6 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -387,10 +387,13 @@ static int ddebug_parse_query(char *words[], int nwords, query->module = modname; for (i = 0; i < nwords; i += 2) { - if (!strcmp(words[i], "func")) { - rc = check_set(&query->function, words[i+1], "func"); - } else if (!strcmp(words[i], "file")) { - if (check_set(&query->filename, words[i+1], "file")) + char *keyword = words[i]; + char *arg = words[i+1]; + + if (!strcmp(keyword, "func")) { + rc = check_set(&query->function, arg, "func"); + } else if (!strcmp(keyword, "file")) { + if (check_set(&query->filename, arg, "file")) return -EINVAL; /* tail :$info is function or line-range */ @@ -406,18 +409,18 @@ static int ddebug_parse_query(char *words[], int nwords, if (parse_linerange(query, fline)) return -EINVAL; } - } else if (!strcmp(words[i], "module")) { - rc = check_set(&query->module, words[i+1], "module"); - } else if (!strcmp(words[i], "format")) { - string_unescape_inplace(words[i+1], UNESCAPE_SPACE | + } else if (!strcmp(keyword, "module")) { + rc = check_set(&query->module, arg, "module"); + } else if (!strcmp(keyword, "format")) { + string_unescape_inplace(arg, UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_SPECIAL); - rc = check_set(&query->format, words[i+1], "format"); - } else if (!strcmp(words[i], "line")) { - if (parse_linerange(query, words[i+1])) + rc = check_set(&query->format, arg, "format"); + } else if (!strcmp(keyword, "line")) { + if (parse_linerange(query, arg)) return -EINVAL; } else { - pr_err("unknown keyword \"%s\"\n", words[i]); + pr_err("unknown keyword \"%s\"\n", keyword); return -EINVAL; } if (rc) -- 2.26.2