Message ID | 20181101170635.13493-1-sbabic@denx.de |
---|---|
State | Changes Requested |
Headers | show
Return-Path: <swupdate+bncBCXPLOXJ6IKRBJPF5TPAKGQEBTHYXCI@googlegroups.com> 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:4864:20::440; helo=mail-wr1-x440.google.com; envelope-from=swupdate+bncbcxploxj6ikrbjpf5tpakgqebthyxci@googlegroups.com; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="B32KTSWD"; dkim-atps=neutral Received: from mail-wr1-x440.google.com (mail-wr1-x440.google.com [IPv6:2a00:1450:4864:20::440]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42mBSn0k4kz9sRc for <incoming@patchwork.ozlabs.org>; Fri, 2 Nov 2018 04:06:48 +1100 (AEDT) Received: by mail-wr1-x440.google.com with SMTP id u8-v6sf16139976wrn.17 for <incoming@patchwork.ozlabs.org>; Thu, 01 Nov 2018 10:06:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1541092006; cv=pass; d=google.com; s=arc-20160816; b=EH3XdlZpaNa8EycBwYexHaaS6gsOyKc/OnbYhRVw3TM7kiXYRDlnpCGVazTgrmQxEg iyVWt2EGSR8EOhPhhHBHO9NhzmSTgu8VFZ0W2Z2UzCtPzbVlzRFqE29N20DVKEFzBdQq 8r0sR3Mz5UNPatFAD4F/Li8WBMFoEmLlFfi4EMuzf25LbaPqIIXrjTSiknwlVyDPYUJx 7Bbc6eg30wGyuUav3Dhk+GyZKg+LymaqCSpPYVMkg9QLeEMKPk/n6mIhxM9VJDPSMlr7 B6Efzjdu2PxiIC4Jtz2OqJtYbXz+ES5Omfn8SCi7Pq/8/OWZmWSDVEgKcc9kZN2PiAZj o5Vw== 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 :mime-version:sender:dkim-signature; bh=G8B56IZ6ftvjZVTuWXXUzlJTQ2/PbmZ/uJjVElc/Dz8=; b=qQKxQCsSCp4WA9sXHGMvh5J+S8tNiXqtTF48rbEW+kXF2nVfpAGHlYtPyYanX+qr34 U3RG1ZZtuo9ZQXvfviSX5AlFUDf6oTbmOXZy+9tZOASuuP7WYWyogSEgnx/A5SdRcjOS zmJQeZoWp9mgkdo4zXFcRS6Z3XWRuH0LsxyMk1+b6PHXyrhApVg7cURVZ0hdtQO8fSJw sqpcmKd3Td/gbfE2gfFv38A07ojtCTasYiXpo1SfrM2jmBS1pPuX5sgkF+CkOWKez3GC 1lGhE5rDlwF+GHD2ZNjUOdwSK5DuMWrXtNoefncIVOOw2iTh4CPCAE6EslZ1ZcMXvqzV qClw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de 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=G8B56IZ6ftvjZVTuWXXUzlJTQ2/PbmZ/uJjVElc/Dz8=; b=B32KTSWDGNgwmpLRzLWVUGc9cRGYCLs41moEeqqbeYwf5RIRqZDFojPuNgywbrAjDP qCydpkph9bCWpZG7OtiQHICTjDjavY/XxuaOpxszfAf2yF1Muk0828o/zhQL7owGJmOp F7wdim/ZaT0LdYBynNfg0GsAP2IVsfXcF5tXGP+scd9K5QB2NWbt18fWZ3EfBHZ2plPA 7PaA80Yk7Ah8h0we59XUTUAKrw0CscItDrc/KM7dZuvANuro+zbdRA1dkvAatlV3l8Vc 5XHmVuWe/EJ4SxmC0HE+Rs5iIMY2m7V+6QEWK3AERkFaJMVLoUG0AhgbXGz1MCf4zwGL DbLA== 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=G8B56IZ6ftvjZVTuWXXUzlJTQ2/PbmZ/uJjVElc/Dz8=; b=l3S/RUMmbAEN+PM4I8z/dltnEdAuqCENVkEeGd3mkNaPQjVHzjOhVyFFFlZnZN94fi 7FH2nMqAGpi6MSqgs9LSQyQoigaXeh1V8UUIbc2reekh3aVexmDR6tymKC/JIZSCGWbH QMGSzzhZxHJI+uRxsxaPcaazI5/PpTlWMhYh1olryOaDumkV+g936O5HHoSu4YNzQZLP NAQ+rawtRJ756vd4d6BmaSgcM0W8usc1pl3A9OblBaGg7Y+YczfjTqyl75hH5xkPkFVh YRwvw1OLUT64qq5dkSaj4tdMl0qyVRlXpxzvxOsYYIdqmXnbeTOBy+wwfK6gPWHIZlQt 7ppg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AGRZ1gI11XzGz4sgNiq3PU8cv9iLRCIv1Y3cUmvd7pgjwyckwdYv6bsf GUIQTZU+cRRaagDtnbwfTVE= X-Google-Smtp-Source: AJdET5dMb3/ShWEWgQvxs83T114awiADCgsvZpzs/awdA+XpFaNtuDtLb7BXWzChHS88BCDBk40R4Q== X-Received: by 2002:a5d:5288:: with SMTP id c8-v6mr94627wrv.4.1541092005857; Thu, 01 Nov 2018 10:06:45 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:45c5:: with SMTP id b5-v6ls3786520wrs.2.gmail; Thu, 01 Nov 2018 10:06:45 -0700 (PDT) X-Received: by 2002:adf:e351:: with SMTP id n17-v6mr825060wrj.16.1541092005336; Thu, 01 Nov 2018 10:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541092005; cv=none; d=google.com; s=arc-20160816; b=rBB/hgICQMyeXgJQ5jS3DBkHlRf6D47Z493szBZRYe8FMmP8Ay0+IjLlAsUq2Lv0Qk Mj/lC1WR51IjBGRea+DAIqeJ0AcUwM5FndK0yfy+a7aqsKPhLdmjLBplD4EplQGLkypt Wst+IfiRkyIpEpPJbR34QEDY/0EG63Rj7N3UHV6zmjRJhtRgomGiXX9Nh149RYcLgPTP Iu2LV6NkXPIOSEBcf7SFWFj8OzG2+Y52DaPl0k3CzjIgfejftlJLWpFszmxyX/HI7xk4 GXYAzmkYou3cBZoZzYCtMNJuj+s75KTO2GVfp3rOFarbgFae/Y3EMlrs02yvuK6QXU6Q xt/g== 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; bh=eIzLQtx5qpvCit5sv05EumvgVRRYC1mNMl20fzMzkfA=; b=swjciETBmlpVyrHmoSkRsglmtAfqQ7dN7PMwXquyMrNX24QHT7dj4l2jeW4q8nvvPT zbOiKIBB4wpa3s5JmrwgOB1niJsoEljGrxp3McmBpdNRO5gk0ZcyssKiFWBsZEiXyvRV gnGuQDhUrzA8iw/VYujG6zmBlLvrgmpxHawizTm5+/VsgQFVA+HoWW4c3RtYSlqrNMeq UD0O4wwybUlsTkESemJqbWDBsINxh+B0r+NHuPVQ4bWFAX3jN75FHw9cScJCWOBVYm6e BCTk5NuHTiSjpu8RJayScVCviGXCRSQfugXY66rqS5GWrYvmgvl/c8CwSyYD2jSJ3Hnn HLCQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [2001:a60:0:28:0:1:25:1]) by gmr-mx.google.com with ESMTPS id h137-v6si792778wmd.1.2018.11.01.10.06.45 for <swupdate@googlegroups.com> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 10:06:45 -0700 (PDT) Received-SPF: neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=2001:a60:0:28:0:1:25:1; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 42mBSj0xKPz1qxK6; Thu, 1 Nov 2018 18:06:45 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 42mBSj0lXnz1qsJN; Thu, 1 Nov 2018 18:06:45 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id pkSsQg-UTgJO; Thu, 1 Nov 2018 18:06:44 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Thu, 1 Nov 2018 18:06:43 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 71ED34540489; Thu, 1 Nov 2018 18:06:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v_mP0Fa8XC2R; Thu, 1 Nov 2018 18:06:41 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 0940C4540360; Thu, 1 Nov 2018 18:06:40 +0100 (CET) From: Stefano Babic <sbabic@denx.de> To: swupdate@googlegroups.com Cc: Stefano Babic <sbabic@denx.de> Subject: [swupdate] [PATCH 1/5] Factorize function to count elements in array of strings Date: Thu, 1 Nov 2018 18:06:31 +0100 Message-Id: <20181101170635.13493-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
[1/5] Factorize function to count elements in array of strings
|
expand
|
diff --git a/core/util.c b/core/util.c index 15d38b7..a357ea3 100644 --- a/core/util.c +++ b/core/util.c @@ -481,6 +481,22 @@ char** string_split(const char* in, const char d) return result; } +/* + * Count number of elements in an array of strings + * Last item must have a NULL terminator + */ +unsigned int count_string_array(const char **nodes) +{ + const char **iter = nodes; + int count = 0; + + while (*iter != NULL) { + iter++; + count++; + } + return count; +} + unsigned long long ustrtoull(const char *cp, unsigned int base) { errno = 0; diff --git a/include/util.h b/include/util.h index 06f4a83..0a95967 100644 --- a/include/util.h +++ b/include/util.h @@ -179,6 +179,7 @@ void get_sw_versions(char *cfgfname, struct swupdate_cfg *sw); __u64 version_to_number(const char *version_string); int check_hw_compatibility(struct swupdate_cfg *cfg); int count_elem_list(struct imglist *list); +unsigned int count_string_array(const char **nodes); /* Decryption key functions */ int load_decryption_key(char *fname);
Signed-off-by: Stefano Babic <sbabic@denx.de> --- core/util.c | 16 ++++++++++++++++ include/util.h | 1 + 2 files changed, 17 insertions(+)