From patchwork Mon Feb 26 14:11:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 775867 Delivered-To: patch@linaro.org Received: by 2002:a5d:6103:0:b0:33d:da16:65b6 with SMTP id v3csp348702wrt; Mon, 26 Feb 2024 06:12:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVhvK0JvuzaRboXOCeeUfiIhx5IMHQ15rYEF5ov+iRY45e6C4vhqXFNjBLKlgEsC9P7KQxixkzvqoLF1Oj0HNxm X-Google-Smtp-Source: AGHT+IF4kpF2e9kqQJ5lrAU8QZ8A3tsbC75NtMLUS07MaphQbiVGGiXtcseS1joOKQZiEdNII00W X-Received: by 2002:a05:622a:1a86:b0:42d:f362:8c8e with SMTP id s6-20020a05622a1a8600b0042df3628c8emr9343258qtc.23.1708956756732; Mon, 26 Feb 2024 06:12:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708956756; cv=none; d=google.com; s=arc-20160816; b=BPnn7lj+DHd6UWENELf1KjeBnwdET26XBR1+W0hwXO6mpZ/5oAYBZWLXzhKVDmx5gb jUggz3hHzFFNGZsx9ujeyq9LbJWWTwenaIdgzes0dRHBKRNPlmsToirYGtiVZ42cks2k qUp4E/MOpf32WKPv3R/F7OA/k4/NJ7ARQeHI2z49cbqUaS7ZtRM2miZVsVyUY9AXzdmj 3K85uiBBZVp0myWwITaZd1NVbhbBScl9ap+I+w5oFNZELlsl8IwIGG82LZnzWKlqJdAs kKGKRpVwcqaTWPTuyC9jxpRvFdofqOv59Ao3OQZ3Y8U1+mHnKKkm5LhX+qIx3vkuG4rM +DJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vKjecqdxRCZ5NMK4buR6wBDSR91vGXc+/LHUa2wYvFI=; fh=IQu3r+cHSJqlwj21O6VeVFreqrZ9Z8Fr9GRd1S5VkGc=; b=sgIUrOrWGjvS1gu9zODah1JacnOa2LLAPJfJavb0HEhFrU87f/7ZSoAZFqO1nQJfo3 wUeeKBVAHoH3h1E9mq26QjHXwsfHYxtuVqTwPCQ04YU5tM21dMhdZZtq6os8ZkEt4D4L v+FE9XxZ61bDgYrMtyIA/Agxldg8SOB8VPcQAwuYY2mm90eDXkFtYaAt9yBakZZL6SsU 1pEq2bYSG3VlI+T9o87Eb5eL9RezcacW/6STKZCOQJhaZHjCBnKYHojfgQgEUUTPZFb2 yXPr+Akzv+7Znh/WNsG9+XTszvT7vFuT4ad15PdJLxxXtyu0xhrLTt0+PV0jw3dqw9ba RIuQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XFvPHYIy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y5-20020a05622a004500b0042e8756684fsi1923116qtw.112.2024.02.26.06.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Feb 2024 06:12:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XFvPHYIy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rebhb-00039f-05; Mon, 26 Feb 2024 09:11:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rebhX-000396-5e for qemu-devel@nongnu.org; Mon, 26 Feb 2024 09:11:27 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rebhV-00024A-H5 for qemu-devel@nongnu.org; Mon, 26 Feb 2024 09:11:26 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-565ef8af2f5so1276032a12.3 for ; Mon, 26 Feb 2024 06:11:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708956684; x=1709561484; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vKjecqdxRCZ5NMK4buR6wBDSR91vGXc+/LHUa2wYvFI=; b=XFvPHYIy8rbpshtkBkvNl9VXn6hnwQj3Y2qWZRXvSHnjxIiz+O1XAzqMY+0DSBY3eP oQuNfHC7sSWPd9fVF3444nVIzz/tDEvdAIEMf6EPqhGiDZTfMBCbnponDGySsFL+t9Js 3IjLUeSjPWfLefyvKhmN9JJ78AaNb4WHPY6wrvJ2DQuRieEqG32ABAXEf8U6LwcDIskX DgF7JVK4IhqVqW89nozt3g08o2WxKcBudaD9xEycPy6pAdr7a/JafGW4gAxH/HNwJypr lZw0+K+SYlx1F+yqQjXSb+JsdDGmOhmvuOELo18IsVrPFB52ixPE5BBekMp8UDM2G63/ /mwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708956684; x=1709561484; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vKjecqdxRCZ5NMK4buR6wBDSR91vGXc+/LHUa2wYvFI=; b=fArWBlVnVSim7/SjU+aqeghIqJbE2ONc62R5JrjwCebjZ8gTOkrWroawCovJiLC3kP J752vwgA7Wyc4nLiKNapIoaSAhI0WQbjxuPDYWukOb1sawQ0+OW3zNYLvC4mw0W8RZX2 u0P9ACfKudDoiSDV0oHbOUJoKBLNhA+LtrotAR+gjRIwh5cXTGI1vglKnn7wSDG+x6nA ntnIcZLhw0m51ZANHAqgnCEFJgZZlGjnsxL3UHaazk/UDkliMsZhj9gp2tEEjUr6MGUJ wt1NUxtw9FBEEt7L5YJf1i3lXYcrSq4ro6RuEtcbN2ZBAsxIOQOGBnO3n1sCONDLON8Y nofw== X-Forwarded-Encrypted: i=1; AJvYcCXE0ndVnzVJeXyq/zgTQMQ13TTy7O8Zm2zia4VMHLZmBk7rekm0hxCB4o0ET0cyUlP3CuswbM6VkvPVibj9S9v7dACOs2A= X-Gm-Message-State: AOJu0YwdvmNx9LY9iY+AtP07ZmiB6Bb7lAoVYLI3eaZ+A6WxtolGVOks JxzlGCTJ0Yp7EsYVwXRHm9/Qm8FvFskaLi2BOabUo1CiwzQe4sdAmIuFFOc2/gg= X-Received: by 2002:aa7:d48f:0:b0:565:9f59:b3bf with SMTP id b15-20020aa7d48f000000b005659f59b3bfmr4383451edr.6.1708956683815; Mon, 26 Feb 2024 06:11:23 -0800 (PST) Received: from m1x-phil.lan ([176.187.223.153]) by smtp.gmail.com with ESMTPSA id eo8-20020a056402530800b00565001948dfsm2374623edb.44.2024.02.26.06.11.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 26 Feb 2024 06:11:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Markus Armbruster , qemu-devel@nongnu.org, Steve Sistare Cc: "Dr. David Alan Gilbert" , Jason Wang , Michael Roth , Peter Xu , Fabiano Rosas , =?utf-8?q?Ma?= =?utf-8?q?rc-Andr=C3=A9_Lureau?= Subject: [PATCH v6 2/5] qapi: QAPI_LIST_LENGTH Date: Mon, 26 Feb 2024 15:11:04 +0100 Message-ID: <20240226141108.73664-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240226141108.73664-1-philmd@linaro.org> References: <20240226141108.73664-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Steve Sistare Signed-off-by: Steve Sistare Reviewed-by: Marc-André Lureau Message-ID: <1708638470-114846-3-git-send-email-steven.sistare@oracle.com> --- include/qapi/util.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/qapi/util.h b/include/qapi/util.h index 81a2b13a33..20dfea8a54 100644 --- a/include/qapi/util.h +++ b/include/qapi/util.h @@ -56,4 +56,17 @@ int parse_qapi_name(const char *name, bool complete); (tail) = &(*(tail))->next; \ } while (0) +/* + * For any GenericList @list, return its length. + */ +#define QAPI_LIST_LENGTH(list) \ + ({ \ + size_t _len = 0; \ + typeof(list) _tail; \ + for (_tail = list; _tail != NULL; _tail = _tail->next) { \ + _len++; \ + } \ + _len; \ + }) + #endif