Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1235307imm; Tue, 5 Jun 2018 11:07:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJmyWSIFkmYHzsYpRWuT8A+7a/MEzv54C8kY+S6pFNKH7koz2a1G8fVqkl5yMzcaLdFJ3O+ X-Received: by 2002:a63:7207:: with SMTP id n7-v6mr21492651pgc.195.1528222042317; Tue, 05 Jun 2018 11:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528222042; cv=none; d=google.com; s=arc-20160816; b=heayWAhAQN+J0ntY/tdSMLQKwqGb0RsU7QXrRBsPmypEZAKL4V8Fzz5FFxTZLAPxXR Ojq/T0FAtJen+SzQrPdiJew5jVJ5sZE4FOfrnJlzz9zzftGaalHuEYItH8U9P5Jxc0S8 arKJEQwng4r5VA83Stx8mviYZ6fjPW60JX0ZTujroyQTcs8jzH3cL84h3Opxu5fB44qa nqnxnWhQwEGh8SchnouokoWiP4ANPrOV6ovjWjmJHJufdt7guLQmrrM4vr7g2v86xxz6 ds4S5zt/+1y3G9iTz2SxQAjUPTYXIO1gk2jzFx1Hp5wQQ/pCu1MYucbmDT7mT182qyEM TvlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=dbHTScty1Lwm0Nuc0gNiMsbZtqm+zESPEo46Lv4Njp8=; b=voAMdRIiz/pZqDPZ1tBwpb2Lr+WtDdPVqqrqB4IRs2b/NQeM2+CW65P0PSOHPx5OuP EFAY+GIcN3wDeWSn7hBRQ/EzekqHJbe2p8MkcDx38pVQjHjqQj1jzqlHWfb2GEpnPlJ9 4EPcdi82umRprMJuj8vjh2tMsf/rImCyLa4CT22L/BAdnlFfHK5sXC4yUfVdclmcotDE iX/0zX4oj9y33KIYrhmJSkAzjqEKvCdQgZBqBNR7BNF9zTy+deZx4XtP4vMApg+h6xxc xhqELFheb6go7Yu+Su+D2Hzuy2ekGgvr9OJaWCEqdxTsZGYOb2k9rGP+l3GnQRckpo3j 21Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B6Nxselw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p4-v6si10302971pfg.329.2018.06.05.11.07.08; Tue, 05 Jun 2018 11:07:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B6Nxselw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751959AbeFERur (ORCPT + 99 others); Tue, 5 Jun 2018 13:50:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:45284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852AbeFERup (ORCPT ); Tue, 5 Jun 2018 13:50:45 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BCE220874; Tue, 5 Jun 2018 17:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1528221044; bh=COh+pJPmhJmoFe5PC7K95+Hst53v4GtVVSePWCnz874=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6Nxselw5uNowSZa0rfvi21qAHsrwEn10GUe0OOxnsXRQhUjLCbcBCvv31blHXJJ/ eqpA7mTFLR4PWa9Ujlux/MqmGPVlcdLBQaifd+U8/+tkGZ946mIHRhJIYjYFH/XvaW TIEtGi9fqM8cE2GIAfA4XXbXnn7NH0vciSkGLuME= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: [PATCH 01/46] perf tools: Remove dead quote.[ch] code Date: Tue, 5 Jun 2018 14:49:45 -0300 Message-Id: <20180605175030.32549-2-acme@kernel.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605175030.32549-1-acme@kernel.org> References: <20180605175030.32549-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo In c68677014bac ("perf tools: Remove support for command aliases") we removed the only remaining use of a function provided by these files, so ditch it. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-mgnzqbi46gucs48d7bzfwr55@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/perf.c | 1 - tools/perf/util/Build | 1 - tools/perf/util/quote.c | 62 ------------------------------------------------- tools/perf/util/quote.h | 31 ------------------------- 4 files changed, 95 deletions(-) delete mode 100644 tools/perf/util/quote.c delete mode 100644 tools/perf/util/quote.h diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 51c81509a315..a11cb006f968 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -12,7 +12,6 @@ #include "util/env.h" #include #include "util/config.h" -#include "util/quote.h" #include #include "util/parse-events.h" #include diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 5d4c45b76895..b604ef334dc9 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -24,7 +24,6 @@ libperf-y += libstring.o libperf-y += bitmap.o libperf-y += hweight.o libperf-y += smt.o -libperf-y += quote.o libperf-y += strbuf.o libperf-y += string.o libperf-y += strlist.o diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c deleted file mode 100644 index 22eaa201aa27..000000000000 --- a/tools/perf/util/quote.c +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include -#include "strbuf.h" -#include "quote.h" -#include "util.h" - -/* Help to copy the thing properly quoted for the shell safety. - * any single quote is replaced with '\'', any exclamation point - * is replaced with '\!', and the whole thing is enclosed in a - * - * E.g. - * original sq_quote result - * name ==> name ==> 'name' - * a b ==> a b ==> 'a b' - * a'b ==> a'\''b ==> 'a'\''b' - * a!b ==> a'\!'b ==> 'a'\!'b' - */ -static inline int need_bs_quote(char c) -{ - return (c == '\'' || c == '!'); -} - -static int sq_quote_buf(struct strbuf *dst, const char *src) -{ - char *to_free = NULL; - int ret; - - if (dst->buf == src) - to_free = strbuf_detach(dst, NULL); - - ret = strbuf_addch(dst, '\''); - while (!ret && *src) { - size_t len = strcspn(src, "'!"); - ret = strbuf_add(dst, src, len); - src += len; - while (!ret && need_bs_quote(*src)) - ret = strbuf_addf(dst, "'\\%c\'", *src++); - } - if (!ret) - ret = strbuf_addch(dst, '\''); - free(to_free); - - return ret; -} - -int sq_quote_argv(struct strbuf *dst, const char** argv, size_t maxlen) -{ - int i, ret; - - /* Copy into destination buffer. */ - ret = strbuf_grow(dst, 255); - for (i = 0; !ret && argv[i]; ++i) { - ret = strbuf_addch(dst, ' '); - if (ret) - break; - ret = sq_quote_buf(dst, argv[i]); - if (maxlen && dst->len > maxlen) - return -ENOSPC; - } - return ret; -} diff --git a/tools/perf/util/quote.h b/tools/perf/util/quote.h deleted file mode 100644 index 274bf26d3511..000000000000 --- a/tools/perf/util/quote.h +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __PERF_QUOTE_H -#define __PERF_QUOTE_H - -#include - -/* Help to copy the thing properly quoted for the shell safety. - * any single quote is replaced with '\'', any exclamation point - * is replaced with '\!', and the whole thing is enclosed in a - * single quote pair. - * - * For example, if you are passing the result to system() as an - * argument: - * - * sprintf(cmd, "foobar %s %s", sq_quote(arg0), sq_quote(arg1)) - * - * would be appropriate. If the system() is going to call ssh to - * run the command on the other side: - * - * sprintf(cmd, "git-diff-tree %s %s", sq_quote(arg0), sq_quote(arg1)); - * sprintf(rcmd, "ssh %s %s", sq_util/quote.host), sq_quote(cmd)); - * - * Note that the above examples leak memory! Remember to free result from - * sq_quote() in a real application. - */ - -struct strbuf; - -int sq_quote_argv(struct strbuf *, const char **argv, size_t maxlen); - -#endif /* __PERF_QUOTE_H */ -- 2.14.3