From patchwork Sat Jun 28 01:25:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Franz X-Patchwork-Id: 32647 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 697B4200B9 for ; Sat, 28 Jun 2014 01:27:31 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id y20sf33846068ier.9 for ; Fri, 27 Jun 2014 18:27:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=EENMdXoCm2R6GC3cCXhMJDacz6b5Tt7alGMeHV9hcSU=; b=FjO1UC+6CaUa74PHtWB3Pj3eh3gxU397yxBGyfyaOViiEZAHO1gvzFpIcLRy798QSB 8YdkJX+Zl3FFN8GtgVO2sS0OCTImwzbG2rroU7+tkyKiPjziG+bfqmXDbvjfOJ5EW1Yu izF2OpZyHby8XsB33ZCo+u8QQf4bRpaWbmg/qWj1r5qjU+fOGbLsAnqj8lQrtLayz4x1 pDeWUTx8S79ZVDFcqChs8oWNuVKhdtKiv/RtFwGz0CPc5qKKrOUu10Ea62siJ+aWgkkQ SqIcvOs1KqEjYr/3lmQQpmfpAXpmkq42WWvZtfRpK7OgAvq/bYK9ihQpVHjErcG9ruy7 S0Tg== X-Gm-Message-State: ALoCoQlMUOaE8oSrINfZI6ocjfzb+ENuwEwzRzEfb4t13NVzoI+GRBiv71t5hk3ZGbAf8FmTHZzW X-Received: by 10.42.109.148 with SMTP id l20mr13088020icp.0.1403918851003; Fri, 27 Jun 2014 18:27:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.240 with SMTP id f103ls750541qgd.95.gmail; Fri, 27 Jun 2014 18:27:30 -0700 (PDT) X-Received: by 10.58.12.73 with SMTP id w9mr23424628veb.13.1403918850918; Fri, 27 Jun 2014 18:27:30 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id yl10si7223419veb.92.2014.06.27.18.27.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Jun 2014 18:27:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jx11so6051560veb.6 for ; Fri, 27 Jun 2014 18:27:30 -0700 (PDT) X-Received: by 10.52.26.237 with SMTP id o13mr19154099vdg.1.1403918850598; Fri, 27 Jun 2014 18:27:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp147846vcb; Fri, 27 Jun 2014 18:27:30 -0700 (PDT) X-Received: by 10.224.104.10 with SMTP id m10mr39261508qao.27.1403918849690; Fri, 27 Jun 2014 18:27:29 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p8si1147200qct.15.2014.06.27.18.27.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 27 Jun 2014 18:27:29 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X0hOx-0007Hm-1S; Sat, 28 Jun 2014 01:25:59 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X0hOv-0007GJ-AT for xen-devel@lists.xen.org; Sat, 28 Jun 2014 01:25:57 +0000 Received: from [193.109.254.147:40719] by server-9.bemta-14.messagelabs.com id 7F/85-14237-4A91EA35; Sat, 28 Jun 2014 01:25:56 +0000 X-Env-Sender: roy.franz@linaro.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1403918754!14205666!1 X-Originating-IP: [209.85.220.46] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3142 invoked from network); 28 Jun 2014 01:25:55 -0000 Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by server-2.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 28 Jun 2014 01:25:55 -0000 Received: by mail-pa0-f46.google.com with SMTP id eu11so5331706pac.5 for ; Fri, 27 Jun 2014 18:25:54 -0700 (PDT) X-Received: by 10.68.222.196 with SMTP id qo4mr35227155pbc.14.1403918753985; Fri, 27 Jun 2014 18:25:53 -0700 (PDT) Received: from rfranz-t520.local (c-24-10-97-91.hsd1.ca.comcast.net. [24.10.97.91]) by mx.google.com with ESMTPSA id eh4sm16637918pbc.79.2014.06.27.18.25.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Jun 2014 18:25:53 -0700 (PDT) From: Roy Franz To: xen-devel@lists.xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com, tim@xen.org, jbeulich@suse.com, keir@xen.org Date: Sat, 28 Jun 2014 02:25:24 +0100 Message-Id: <1403918735-30027-9-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1403918735-30027-1-git-send-email-roy.franz@linaro.org> References: <1403918735-30027-1-git-send-email-roy.franz@linaro.org> Cc: Roy Franz , fu.wei@linaro.org, linaro-uefi@lists.linaro.org Subject: [Xen-devel] [PATCH RFC 08/19] Move removal of leading spaces from split_value to get_value() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: roy.franz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Move the removal of leading whitespace from values read from the configuration file to the code that reads them from the config file. This allows more sharing of string related functions. Signed-off-by: Roy Franz --- xen/arch/x86/efi/boot.c | 2 -- xen/arch/x86/efi/efi-shared.c | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/efi/boot.c b/xen/arch/x86/efi/boot.c index 2e3d341..045714b 100644 --- a/xen/arch/x86/efi/boot.c +++ b/xen/arch/x86/efi/boot.c @@ -176,8 +176,6 @@ void __init load_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name, static void __init split_value(char *s) { - while ( *s && isspace(*s) ) - ++s; place_string(&mb_modules[mbi.mods_count].string, s); while ( *s && !isspace(*s) ) ++s; diff --git a/xen/arch/x86/efi/efi-shared.c b/xen/arch/x86/efi/efi-shared.c index 98ad5db..0a67363 100644 --- a/xen/arch/x86/efi/efi-shared.c +++ b/xen/arch/x86/efi/efi-shared.c @@ -337,7 +337,13 @@ char *__init get_value(const struct file *cfg, const char *section, break; default: if ( match && strncmp(ptr, item, ilen) == 0 && ptr[ilen] == '=' ) - return ptr + ilen + 1; + { + ptr += ilen + 1; + /* strip off any leading spaces */ + while ( *ptr && isspace(*ptr) ) + ptr++; + return ptr; + } break; } ptr += strlen(ptr);