From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: [PATCH 2/5] devtools/cocci: make strlcpy replacement smarter Date: Wed, 3 Apr 2019 15:45:02 +0100 Message-ID: <20190403144505.46234-3-bruce.richardson@intel.com> References: <20190403144505.46234-1-bruce.richardson@intel.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Bruce Richardson To: dev@dpdk.org Return-path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 9F0BA1B465 for ; Wed, 3 Apr 2019 16:45:23 +0200 (CEST) In-Reply-To: <20190403144505.46234-1-bruce.richardson@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The original coccinelle script worked by replacing instances of snprintf(.."%s",...) with strlcpy(), but only where the source and dest parameters were plain identifiers. Allowing expressions for those params opens up a wide range of other possible changes. Signed-off-by: Bruce Richardson --- devtools/cocci/strlcpy.cocci | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/devtools/cocci/strlcpy.cocci b/devtools/cocci/strlcpy.cocci index 335e27128..6f6beb697 100644 --- a/devtools/cocci/strlcpy.cocci +++ b/devtools/cocci/strlcpy.cocci @@ -1,6 +1,5 @@ @use_strlcpy@ -identifier src, dst; -expression size; +expression src, dst, size; @@ ( - snprintf(dst, size, "%s", src) -- 2.20.1