From patchwork Wed Jan 10 15:26:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 858343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::23d; helo=mail-wm0-x23d.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbuhc3djakgqe2vvceai@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="SVGaURUF"; dkim-atps=neutral Received: from mail-wm0-x23d.google.com (mail-wm0-x23d.google.com [IPv6:2a00:1450:400c:c09::23d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zGtGW0yBMz9s7M for ; Thu, 11 Jan 2018 02:29:22 +1100 (AEDT) Received: by mail-wm0-x23d.google.com with SMTP id z83sf3057885wmc.5 for ; Wed, 10 Jan 2018 07:29:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1515598160; cv=pass; d=google.com; s=arc-20160816; b=HjbRr3b3hiq/+SRY3j2G8VmbizBRrVxiFM9d76JwUKhaGvjj47Y84Fto/uQy3Na00X TG70HQ6ihTcx1dkZ5Xuxv6DuZlLNTD6RJ4L3KaAxQTVQ6dx/PKm5Pu6uDG/EBpnYo0eE LKpLku0DCayd5XlWj3oEq08+5fBVAPSVw69lNDTPavJ5FwOjmqu7BeT9BftENWEyxroW SJp0Ra8aXqquQJS6Qlxy52FAT/h/8RLo36mSeAt2M+o/oDt4Fsg80x7G8XgP7uER3PUL 086YcC2d4wieeQcSmZS1ZId3T8cYHBYVr/n/z/hPEghdJpn4I1eIwZiA4ZGv0iVNZwDb zD4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=gb7KfJBz+u62Dwz7Nvi0uFXJFthgdokCj5JI7JXLUCY=; b=wGuIrDinWvKaw8amGBum806nQe/I2+Bipd0U+vg0RZ5c3AdYFq57LuHou0akC7zokn 9Km/3S94LX8E4fexfiUtLHG5+hec2xMBDUxR2ot9YvlxgtbB4FP7vYKVadBqCYACInDc KevF6+cU60/4D/wXtswrkm6c1NiS8E0Qi+1NGcRox0G7tjlLyWvOsQjkM53L7SqRcqQa fDh90vfQPG79jN/87MvKxXURR4VNEy42xtf7+0VtXy/RL2AnZKeD4oX7VcbZ6fu/xVEP PFGcYlH72YjwkwCViyRs57+C8eIQPeuKgpY4WbiiTwC01O6+uMjtzDlc3JKZKAJELT+o K6+w== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=christian.storm@siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=gb7KfJBz+u62Dwz7Nvi0uFXJFthgdokCj5JI7JXLUCY=; b=SVGaURUF+siaujRcfjyMFfx/rvQ48shTCEXjpdoM16JExVFNOjLjkNzR4RF7KDKSps mH62RrqAoI3sPQkmsfyI7VQXKBr3TFNcmGNlgB1bqHdAXEE0xCsw6GVwNC43paSQLc27 pTEduHX7csJm+zFHcieHAdoa54BggFcdObD6ZdbIkqow1IDY0S91jrdqJBSvhg8009vb 6g4RK/aOimsUiSQs1A/HNgi6ZSQ6u0oP2OEWE70a5N3mhNqMfjA+tNdkeDZm0f2afMmY 50brzpmFn0x6MH2qGxkBgOYlf8z/DPXd07K5rSNAAW6HW/NBOdg9Ds41TVc20hizeWWJ 58fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=gb7KfJBz+u62Dwz7Nvi0uFXJFthgdokCj5JI7JXLUCY=; b=f7pCWrEtu0wugCWwpRCDyWJCqxHuH8uzcvSXPECWfFrscf5WXEw1WubfiSdwbhOdC+ 8PjsP/Tt3YFH36L5r9ED9g2z9jqYteo4suG+4T6oDXvc6KFd9zo4HkLHxBlgDURP/0QF tdiTUPt9umCAGRuqmcYLARQ1my9U/3HvnVvcFXSapsoiQkYlMCUYpjgwQxfQhRN2YIw8 UC/MExKJ7CPbSit5V4XSnqdyL0YGewNOQ8NsAkM25h770JiY9tJSdqNXSAkCTNHVRkbG m7nnhvlsriuGhIqJk9+pwCA6EEL8rpA+TlzkbWwGpzg1ixNjL5MiPE3W1BHDJ8D2Hamr wHRA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AKwxytddd4SAGOPb3cH1YwWDlDvUp8e576To8zs+TuJ/pVt+DxZ3UqBF wv5Ce0G0+ja0pFTfaJfBTrY= X-Google-Smtp-Source: ACJfBouSNBvRMO60PJ2iYYQ5rWj7DRVtUEX8g5YpTvD0Wr3VseLsuUkoA0risroycZ6ZIyNnOiCe4A== X-Received: by 10.28.111.219 with SMTP id c88mr57799wmi.3.1515598160481; Wed, 10 Jan 2018 07:29:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.249.17 with SMTP id x17ls1082978wmh.11.canary-gmail; Wed, 10 Jan 2018 07:29:19 -0800 (PST) X-Received: by 10.28.118.24 with SMTP id r24mr1779820wmc.6.1515598159868; Wed, 10 Jan 2018 07:29:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515598159; cv=none; d=google.com; s=arc-20160816; b=C7DcWxHrinGfb16KUP2pCROVLCj2CJF1tkX6zaCjiUU2ZZlDRX0JEUhBvX14J/Qs15 lrrlN5CqL9hCRuHTV/uGkSYmebgsuAJ/Nxngu8geroDFIxeUTG+3+azSOYDw9l139PHf xTDNozgfIsrpiiUVmuXiC3xS0fmteU40f3WTyciMD7ctNmhSEKOVCF8o6Bhf7/cIOQrT uxyLdxAJcnS1XMD/Yng+jl1+9ROYd1flo6vqp1QoaM9+J5Bo3wWKujpUNPbk7RbUunot S4sp3SaRPt6FcEw32S6BfQT/xUVuLCQ3ELxvuvD2GDuucAzdV79f+vuWx/j2h5eAXyim hgpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=rCBHKz4Dy49JzrWVlXYD6une+Ro+RCPCFFCuImubCu4=; b=UFbQ/OrvZZ0O8kqFYBkBrVgVHkTXW+/NuLt7k9rTpPNFmkSwR1doqJVcPpfJb+Gfu8 wgMGrwKKAv4RLsiwJxrHnGVis+TqcR8PWcZRcCeGl1kMgUlvD7ffZTnNjtp/L+LZIoXQ lEE2M5GlsKCE1iXOKTShpgYYFeTjheJJN3/exezJqJOcaWsH8e9d1+nKiZQk7NIaFWO6 4tq7m4NoyJ8BFPTyLvnUdhlttYzeV6zThT/7aPYpqb0R/PyqHY9ovlwu1rpJSr5wVfFY g11EalJ+heQsx5jgWMLSMP/ODcHSdr1CfX/mKCm8UITcOkMoKYv1FTrYMxYGQc8qpLA4 dR+A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=christian.storm@siemens.com Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id r70si1859097wmg.2.2018.01.10.07.29.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 07:29:19 -0800 (PST) Received-SPF: pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w0AFTJEA031135 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 10 Jan 2018 16:29:19 +0100 Received: from MD1KR9XC.ww002.siemens.net ([139.25.69.251]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id w0AFTJca032135; Wed, 10 Jan 2018 16:29:19 +0100 From: Christian Storm To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH] option handling: remove unneeded seek_str != NULL check Date: Wed, 10 Jan 2018 16:26:49 +0100 Message-Id: <20180110152649.19635-1-christian.storm@siemens.com> X-Mailer: git-send-email 2.15.1 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of christian.storm@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=christian.storm@siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , The comparison of array seek_str != NULL is always true, hence remove it. Signed-off-by: Christian Storm Reviewed-by: Stefano Babic --- corelib/lua_interface.c | 2 +- parser/parse_external.c | 2 +- parser/parser.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index eba9884..26f10f6 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -252,7 +252,7 @@ static void lua_string_to_img(struct img_type *img, const char *key, strncpy(seek_str, value, sizeof(seek_str)); /* convert the offset handling multiplicative suffixes */ - if (seek_str != NULL && strnlen(seek_str, MAX_SEEK_STRING_SIZE) != 0) { + if (strnlen(seek_str, MAX_SEEK_STRING_SIZE) != 0) { errno = 0; img->seek = ustrtoull(seek_str, &endp, 0); if (seek_str == endp || (img->seek == ULLONG_MAX && \ diff --git a/parser/parse_external.c b/parser/parse_external.c index b876c07..60c2961 100644 --- a/parser/parse_external.c +++ b/parser/parse_external.c @@ -83,7 +83,7 @@ static void sw_append_stream(struct img_type *img, const char *key, strncpy(seek_str, value, sizeof(seek_str)); /* convert the offset handling multiplicative suffixes */ - if (seek_str != NULL && strnlen(seek_str, MAX_SEEK_STRING_SIZE) != 0) { + if (strnlen(seek_str, MAX_SEEK_STRING_SIZE) != 0) { errno = 0; img->seek = ustrtoull(seek_str, &endp, 0); if (seek_str == endp || (img->seek == ULLONG_MAX && \ diff --git a/parser/parser.c b/parser/parser.c index 44cd0fe..3a1d6a5 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -456,7 +456,7 @@ static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua get_hash_value(p, elem, image->sha256); /* convert the offset handling multiplicative suffixes */ - if (seek_str != NULL && strnlen(seek_str, MAX_SEEK_STRING_SIZE) != 0) { + if (strnlen(seek_str, MAX_SEEK_STRING_SIZE) != 0) { errno = 0; image->seek = ustrtoull(seek_str, &endp, 0); if (seek_str == endp || (image->seek == ULLONG_MAX && \