From nobody Tue Feb 10 11:32:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1564590635; cv=none; d=zoho.com; s=zohoarc; b=gIoWy5sIBEuIWjF/immeiLtuvO3LQgUz9OF7lRmz6RyeFtcTUFWoUSyouFvT3XkaYF3A6fhnQCSkPjQOT8qRjUqktEjcUqLPei9Ys5ZhqFYfmqyCtfwGabIgmvlezmo7HEdOTuVfTjfe3Wo+6MOWkykOu2wPznaE500zIdLtUmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564590635; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SeHSnn6Q7MbUbj1wOiuXEk2fDQ1yqleXTuadw7oSvuI=; b=IWrbrw9g1lwFYVyU9O9EpRFsyXtvUGEyNjfNaOHHXBwoZwVhY3p/X58W1hk3bj0QRGuzoAAqkrXTaIUVQOO8367QtRopZH2sLLR32i7yPcAz1D5qzB/Hl3mA26uKfx58GCvCbdbBt+Jy4u2iRxZDisV4sSuZ9AJ4xxt3CAIbq20= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156459063550796.54111469495967; Wed, 31 Jul 2019 09:30:35 -0700 (PDT) Received: from localhost ([::1]:42792 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrUo-0000DF-HP for importer@patchew.org; Wed, 31 Jul 2019 12:30:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45222) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrPo-00052W-9P for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsrPn-0000NZ-9R for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:24 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:32769) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsrPn-0000N6-3G for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:25:23 -0400 Received: by mail-wr1-x443.google.com with SMTP id n9so70471426wru.0 for ; Wed, 31 Jul 2019 09:25:23 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h16sm74107395wrv.88.2019.07.31.09.25.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 09:25:17 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E5B591FF8F; Wed, 31 Jul 2019 17:07:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SeHSnn6Q7MbUbj1wOiuXEk2fDQ1yqleXTuadw7oSvuI=; b=LNeoSnN6Kg+VGwYH8Z4RbpDn3H9/yFqSwzDxeJtve72ahZzm0iXMyXKgWAaR8+fkWH DmbSPVaBUmj3G3umtKXnbKOkZszfjqr0NjxxtyF1m+3EKl5AhM2VC2XC5+dv+l/U96SD UFOk1x5CBDu32Y9cmkb58bzynzAzP2jtdzgiStBZXC7DCfVIfr/2pFt+AIDRoNXVjgUq g2tQ0NMMO6yn2W4oSE8OXAnTl1dPN1VeL7yMCrMK96lyDfLgKWYTysNZMj6/XjmLm9jI vWRgcldwl9zb8QZmYE8L+GHy0PDCAFHZOrMDTTpuaL21/NP4b/2EcIYyPOMpwgLpVXGg HIPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SeHSnn6Q7MbUbj1wOiuXEk2fDQ1yqleXTuadw7oSvuI=; b=q4217IYDg0zpiSlarf9ZcRaNq0cXni3zMwKidYbZdVSyZFAY2TJgx/tFmUahQ+V8wr N3b4/nGzcMP6cY4tluA/Sh8Q/ADz68oGzff8OfRr0F0y/to0CkskUHWeq4UCUtSXGyUa XDlfKMgs4rEdmBuSp45ETRvlgflSqM3ezEus1sScqg2h8yOObMTCEMD5z/LQtu8b2C6o g3CTrrGH5ahzjkPsTPa4XkB/Orh9wHFEnUVUL8vzTY2uRuOJjPXCe2XdswE0gmFGY+UE Fmcd4gz1m+AjuiEumPDzOpGg5+MAZeSgnD5MJAoN1mm5mIqTcxuLpIkr0tk3cvNPhudi zt2w== X-Gm-Message-State: APjAAAXXmNqtqoRmdFudQYmUpPV4DEK5MwFwigTIwzoTvgJ2LQFRzpIo XjmmomUUNuFmpExXoHIVFaxmIg== X-Google-Smtp-Source: APXvYqyo24WJUOkbGrYkUhB1Rs2vPWdpsX9Vo/dmAgoeOdpFUJAVoawbuS28Fgh+ULuGWXgANjcs+w== X-Received: by 2002:adf:ef8d:: with SMTP id d13mr130688452wro.60.1564590322088; Wed, 31 Jul 2019 09:25:22 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 17:06:41 +0100 Message-Id: <20190731160719.11396-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731160719.11396-1-alex.bennee@linaro.org> References: <20190731160719.11396-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v4 16/54] queue: add QTAILQ_REMOVE_SEVERAL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bobby.prani@gmail.com, cota@braap.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aaron@os.amperecomputing.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: "Emilio G. Cota" This is faster than removing elements one by one. Will gain a user soon. Signed-off-by: Emilio G. Cota Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- include/qemu/queue.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index 0379bd8fdbb..66e834dad11 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -422,6 +422,16 @@ union { = \ (elm)->field.tqe_circ.tql_prev =3D NULL; \ } while (/*CONSTCOND*/0) =20 +/* remove @left, @right and all elements in between from @head */ +#define QTAILQ_REMOVE_SEVERAL(head, left, right, field) do { \ + if (((right)->field.tqe_next) !=3D NULL) \ + (right)->field.tqe_next->field.tqe_circ.tql_prev =3D \ + (left)->field.tqe_circ.tql_prev; \ + else \ + (head)->tqh_circ.tql_prev =3D (left)->field.tqe_circ.tql_prev;= \ + (left)->field.tqe_circ.tql_prev->tql_next =3D (right)->field.tqe_n= ext; \ + } while (/*CONSTCOND*/0) + #define QTAILQ_FOREACH(var, head, field) \ for ((var) =3D ((head)->tqh_first); \ (var); \ --=20 2.20.1