From patchwork Sat Oct 5 17:57:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wang yanqing X-Patchwork-Id: 2991631 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4A1A69F169 for ; Sat, 5 Oct 2013 17:57:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 761FB20250 for ; Sat, 5 Oct 2013 17:57:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D9262024F for ; Sat, 5 Oct 2013 17:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752231Ab3JER5h (ORCPT ); Sat, 5 Oct 2013 13:57:37 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:61283 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751525Ab3JER5g (ORCPT ); Sat, 5 Oct 2013 13:57:36 -0400 Received: by mail-pa0-f44.google.com with SMTP id lf10so5566534pab.31 for ; Sat, 05 Oct 2013 10:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=v/Nc6mfbTQ3NX7wSgLs2ZJCHlRdz2zcEvqJppt26bh0=; b=a0mITE8xNBaG14YfWJPigSHXQkowsBr4+Pg19+kqNhgYY4BdZu3ghAiYLkEjQzJZI6 20GlGNp9CHnw/1nh5HzxpI6TiQOd0hcESs7MV87UHeDlCfdaBqSA7FzaaEr8qQ8CNqhk IN+UOXOHg7Pjw8ekb7IvnDfMImIRH+kJ61sMvuWQIdLwUgeXHXDSzpGLYU2BbjvM28SC hD71iyF1PlCkJxJ4JAj3vrj8bl0WGtPKtSkYqMTECh/YJE2SWGn+pIIphMyAt2MPwToZ ub28KihsS8oeITAQNxwCE7ygxABGVmFygA4bX0Z3uRUbT1KJi3UPbSa9iyLtODXNIE3D Gbig== X-Received: by 10.68.225.99 with SMTP id rj3mr13181793pbc.122.1380995855783; Sat, 05 Oct 2013 10:57:35 -0700 (PDT) Received: from udknight.localhost ([218.66.125.74]) by mx.google.com with ESMTPSA id j9sm26921411paj.18.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 05 Oct 2013 10:57:34 -0700 (PDT) Received: from udknight.localhost (udknight.localhost [127.0.0.1]) by udknight.localhost (8.14.4/8.14.4) with ESMTP id r95HvGRI028121; Sun, 6 Oct 2013 01:57:16 +0800 Received: (from root@localhost) by udknight.localhost (8.14.4/8.14.4/Submit) id r95HvFPK028120; Sun, 6 Oct 2013 01:57:15 +0800 Date: Sun, 6 Oct 2013 01:57:15 +0800 From: Wang YanQing To: mmarek@suse.cz Cc: linux-kbuild@vger.kernel.org, yann.morin.1998@free.fr, bpoirier@suse.de, walch.martin@web.de, jdelvare@suse.de, linux-kernel@vger.kernel.org Subject: [PATCH]kconfig:mconf: avoid unneeded memcpy Message-ID: <20131005175715.GA28091@udknight> Mail-Followup-To: Wang YanQing , mmarek@suse.cz, linux-kbuild@vger.kernel.org, yann.morin.1998@free.fr, bpoirier@suse.de, walch.martin@web.de, jdelvare@suse.de, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In function update_text we assign jump key label per page (1)-(9) cycled, and use three space char as the header after k exceed JUMP_NB. We don't need to call memcpy with header of three space char, because it changes nothing, it just copy what was there. I don't think we need to clear old jump key label in current implementation, I can't image out any case which a search result could change its jump key label, unless user search new string, but then we will re-assign jump key label, and it will be fix after that. Signed-off-by: Wang YanQing --- scripts/kconfig/mconf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 2c39631..ff9d737 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -379,11 +379,8 @@ static void update_text(char *buf, size_t start, size_t end, void *_data) data->keys[k] = key; data->targets[k] = pos->target; k++; - } else { - sprintf(header, " "); + memcpy(buf + pos->offset, header, sizeof(header) - 1); } - - memcpy(buf + pos->offset, header, sizeof(header) - 1); } } data->keys[k] = 0;