From patchwork Tue Jul 23 20:38:49 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: 813989 Delivered-To: patch@linaro.org Received: by 2002:adf:f288:0:b0:367:895a:4699 with SMTP id k8csp2489958wro; Tue, 23 Jul 2024 13:43:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVrvS5O1xyiK3JQ1mXzOIVkXX0dQy/Lsj4cQ/2lzq/52Xnd4R+ZFkaRF6+NBR3ueK4wJIXT5RCaafxVIra7IRsf X-Google-Smtp-Source: AGHT+IGz7nmbJ/CSPM4ajLdj5zLN+e5TCSt1pHs+rkVkdamnbXY53dTIujT5YAYblBLH8eSAeHZ/ X-Received: by 2002:a05:6214:f03:b0:6b0:6400:3b6f with SMTP id 6a1803df08f44-6b94f00df9bmr210916386d6.8.1721767408623; Tue, 23 Jul 2024 13:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721767408; cv=none; d=google.com; s=arc-20160816; b=WKyYH2Y75SnbolEiBG7jaU8ggMyaBLC5dFI78hlb0xHmOIJ4SK1BcRZ6/jGFpJL20Y CYzDsH6QwNze5YnowS3FM3AObL1EqDK+Bx5URx4OrnXBhRRpGp7u8BePn/g9CnhjlCb0 JVWnmPZIAqUrMJqviiEHlroCpndXySh+wUb1gbUebjw9IvtKtL5kcvxmZXRuZY/U/Nmn v/8X+OH+dlvdpy4ZN2XMyboa4p4VwKkkQAid9EdXRhF4qite1WBQiDLgNbeMJdM241Ix jGc07qpnysirU6XQ7Cxgrft+xj2+R1rS6Qa5J1L/gv/8/aK7EwM3VOaZD6a1npxWBz4g FDLg== 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=O+mMJVnZoHb8TN0OKgay2wr/RPzQblLQjBQP+26HLiA=; fh=kpPLvM4LppkMl/YKImZ3Ct1+jOKnps+13Iso3OkL16s=; b=nadTB9BvSMWTPTyV4aaZCGstrn3FeakbrGLeVXEpGVSNcedxTw3WkSV4SG/ef/oOCP WeL2nuJgfeLzYAgXa1ZYjKjerhfAdstOIbwaBC50P7tl+Wz6eS+AxCciTjfaKyD01k8+ agWkBW/A5V4NVqd6vYWeoc6QA3oCbXTpf+yBnEa2IBAimPHMEwqIxQ5mNN3Lv/olr4qg aGbgNGemVs68f0O9F4+XX7+FKCDL6shzeIAwCPePxwXy4JZC5QgX7qwAiUqGgdmJ9wMp xrMUoZ5JFXbUMOey8Haa03o1wfR0VBHwY+jV0cqoTJRKC9Yi4EyYNHbFvjv7V/IGIm1D gz5w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EGyVCORb; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b7acafce6esi114004886d6.492.2024.07.23.13.43.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jul 2024 13:43:28 -0700 (PDT) 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=EGyVCORb; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sWMJn-0005QQ-JK; Tue, 23 Jul 2024 16:41:07 -0400 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 1sWMJl-00058g-EB for qemu-devel@nongnu.org; Tue, 23 Jul 2024 16:41:05 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWMJj-0004Vb-4U for qemu-devel@nongnu.org; Tue, 23 Jul 2024 16:41:05 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4266182a9d7so40096685e9.0 for ; Tue, 23 Jul 2024 13:41:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721767261; x=1722372061; 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=O+mMJVnZoHb8TN0OKgay2wr/RPzQblLQjBQP+26HLiA=; b=EGyVCORbD5+5m3pLGsrfX0NJkFSawwF99QsB1ohI4ksFqs2n0/4hlMLjASng0Jm1GW OQM7Sz9lnWc4w3f5cqduLVIQfn9oFqAXTUxhyuFCBEFWlDSypHRb1jXN13e/TbamOLpy JG8VoSdk8xl7XxhL/rop+OneIFlnpDDqkkdXuKV+qkaiX2tdjC9LI+c2xObz6Q3YUkka aWmMCtUiFd9ULd/NvxSELpguR5Qa+Ht/lcrRyTMPTf6NgHg/ozwzTjoTpODX0hrRFzuu Z3+ubmXJMhEZ8/uiRAPc7SV9Hl553cz9j7glaRBVeoxQxWvzYt2+oYvoJquryssNYUt9 uwgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721767261; x=1722372061; 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=O+mMJVnZoHb8TN0OKgay2wr/RPzQblLQjBQP+26HLiA=; b=LcBYWGbf/GS3fU2eQgXA6KT2kr926ixgsfN9sy82Yo6OZMXW3jEOB16rAHBtPo984G /tIqwYX0yARmq3EXDdfEzeoLX8vsr372KYb2D2COVStcA+UuLUctTOeharZCdu0kmBUB FJoufWBKPCbRFaoOuICBoYUiHdXafjX9Vdc8U0JSAv1U8HWuVZ1JVf4Px9G60IjpAYpr fIHUT8hLM2kuhfD9oOGa6VDU/+dOmUKghbVR1tardrbqWn+xq63Fbaw1WQ5ZfJ16flvs Y8+edQ66JScFCXCmXHaXuNFPonqlzMD608OlSbs9ma3SWWOzHSt3ILLI3HkWmCIlVpU5 HvzQ== X-Gm-Message-State: AOJu0YwyKDdPNvfcceSBPC31L0lBan4Vp10Yts/fg4yhit2RsrkVTGde xZe2ahT6bPdGzvinMxDXP84dvHeA5XIjNs47NtE6hPxrCIAxjEenHYLOC4nPpYKFKwOMQUTeWz8 3c+w= X-Received: by 2002:a05:600c:314d:b0:426:55a3:71af with SMTP id 5b1f17b1804b1-427f95b714fmr15955e9.33.1721767261042; Tue, 23 Jul 2024 13:41:01 -0700 (PDT) Received: from localhost.localdomain (vbo91-h01-176-184-50-4.dsl.sta.abo.bbox.fr. [176.184.50.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427f9397204sm541795e9.21.2024.07.23.13.41.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jul 2024 13:41:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Mark Cave-Ayland , Pierrick Bouvier Subject: [PULL 22/28] util/fifo8: Use fifo8_reset() in fifo8_create() Date: Tue, 23 Jul 2024 22:38:49 +0200 Message-ID: <20240723203855.65033-23-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240723203855.65033-1-philmd@linaro.org> References: <20240723203855.65033-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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 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 Avoid open-coding fifo8_reset() in fifo8_create(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Mark Cave-Ayland Reviewed-by: Pierrick Bouvier Message-Id: <20240722160745.67904-4-philmd@linaro.org> --- util/fifo8.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/util/fifo8.c b/util/fifo8.c index 4e01b532d9d..2925fe56119 100644 --- a/util/fifo8.c +++ b/util/fifo8.c @@ -16,12 +16,17 @@ #include "migration/vmstate.h" #include "qemu/fifo8.h" +void fifo8_reset(Fifo8 *fifo) +{ + fifo->num = 0; + fifo->head = 0; +} + void fifo8_create(Fifo8 *fifo, uint32_t capacity) { fifo->data = g_new(uint8_t, capacity); fifo->capacity = capacity; - fifo->head = 0; - fifo->num = 0; + fifo8_reset(fifo); } void fifo8_destroy(Fifo8 *fifo) @@ -97,12 +102,6 @@ const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *numptr) return fifo8_peekpop_buf(fifo, max, numptr, true); } -void fifo8_reset(Fifo8 *fifo) -{ - fifo->num = 0; - fifo->head = 0; -} - bool fifo8_is_empty(Fifo8 *fifo) { return (fifo->num == 0);