{"id":2218979,"url":"http://patchwork.ozlabs.org/api/patches/2218979/?format=json","web_url":"http://patchwork.ozlabs.org/project/ovn/patch/20260402082510.1417440-4-amusil@redhat.com/","project":{"id":68,"url":"http://patchwork.ozlabs.org/api/projects/68/?format=json","name":"Open Virtual Network development","link_name":"ovn","list_id":"ovs-dev.openvswitch.org","list_email":"ovs-dev@openvswitch.org","web_url":"http://openvswitch.org/","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260402082510.1417440-4-amusil@redhat.com>","list_archive_url":null,"date":"2026-04-02T08:25:07","name":"[ovs-dev,3/6] vec: Extend the vector with pop iterator and bsearch wrapper.","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"3d3b9c153c1f9bdb539c958ffa290fc013d15907","submitter":{"id":83634,"url":"http://patchwork.ozlabs.org/api/people/83634/?format=json","name":"Ales Musil","email":"amusil@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ovn/patch/20260402082510.1417440-4-amusil@redhat.com/mbox/","series":[{"id":498451,"url":"http://patchwork.ozlabs.org/api/series/498451/?format=json","web_url":"http://patchwork.ozlabs.org/project/ovn/list/?series=498451","date":"2026-04-02T08:25:04","name":"Netlink notifier consolidation and nexthop table support","version":1,"mbox":"http://patchwork.ozlabs.org/series/498451/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2218979/comments/","check":"fail","checks":"http://patchwork.ozlabs.org/api/patches/2218979/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ovs-dev-bounces@openvswitch.org>","X-Original-To":["incoming@patchwork.ozlabs.org","dev@openvswitch.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ovs-dev@lists.linuxfoundation.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=YQ01C5Xu;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org)","smtp2.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=YQ01C5Xu","smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","smtp1.osuosl.org;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.a=rsa-sha256 header.s=mimecast20190719 header.b=YQ01C5Xu"],"Received":["from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmZg16Rhhz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 19:25:33 +1100 (AEDT)","from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id 5D10F4074C;\n\tThu,  2 Apr 2026 08:25:27 +0000 (UTC)","from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id qqjulblp6jqm; Thu,  2 Apr 2026 08:25:26 +0000 (UTC)","from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id 02476406AE;\n\tThu,  2 Apr 2026 08:25:25 +0000 (UTC)","from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id DC41DC054B;\n\tThu,  2 Apr 2026 08:25:24 +0000 (UTC)","from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 65844C054C\n for <dev@openvswitch.org>; Thu,  2 Apr 2026 08:25:23 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 2E9AC813F5\n for <dev@openvswitch.org>; Thu,  2 Apr 2026 08:25:23 +0000 (UTC)","from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id 7FADfW5Z6tX3 for <dev@openvswitch.org>;\n Thu,  2 Apr 2026 08:25:22 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp1.osuosl.org (Postfix) with ESMTPS id 06AE8813BA\n for <dev@openvswitch.org>; Thu,  2 Apr 2026 08:25:21 +0000 (UTC)","from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-xIcBHYWbOMyDFsI5giRKjw-1; Thu,\n 02 Apr 2026 04:25:19 -0400","from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id B399518005BD\n for <dev@openvswitch.org>; Thu,  2 Apr 2026 08:25:18 +0000 (UTC)","from amusil.brq.redhat.com (unknown [10.43.17.233])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id A5C3530030CD; Thu,  2 Apr 2026 08:25:17 +0000 (UTC)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections -\n client-ip=2605:bc80:3010:104::8cd3:938; helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp2.osuosl.org 02476406AE","OpenDKIM Filter v2.11.0 smtp1.osuosl.org 06AE8813BA"],"Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=amusil@redhat.com;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp1.osuosl.org 06AE8813BA","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775118320;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=9zo64dn0CwHdW677gq0+57o29KF+5cwaoPe1H8SVDcU=;\n b=YQ01C5XuY65VDFNPTpB00nYeFVKSn29UYwGuP3XpcuqGeUjVJAaVQMzpbirzeaha/Vgy0p\n kX01tNwB7aVvGeMn0Z2NrohE6Aw5dAaBkD5fcJ+5jEppvGT5DHtyrPMX1z6SpOKFAxeHvg\n JWVCOjyo/j7m3N0xXPyV7wE99khhU5c=","X-MC-Unique":"xIcBHYWbOMyDFsI5giRKjw-1","X-Mimecast-MFC-AGG-ID":"xIcBHYWbOMyDFsI5giRKjw_1775118318","To":"dev@openvswitch.org","Date":"Thu,  2 Apr 2026 10:25:07 +0200","Message-ID":"<20260402082510.1417440-4-amusil@redhat.com>","In-Reply-To":"<20260402082510.1417440-1-amusil@redhat.com>","References":"<20260402082510.1417440-1-amusil@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.4","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"mpT_E2wkvdwOOMBpMeNOoO6A9sUnnwELJ6d9Dsdi7dc_1775118318","X-Mimecast-Originator":"redhat.com","Subject":"[ovs-dev] [PATCH ovn 3/6] vec: Extend the vector with pop iterator\n and bsearch wrapper.","X-BeenThere":"ovs-dev@openvswitch.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"<ovs-dev.openvswitch.org>","List-Unsubscribe":"<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>","List-Archive":"<http://mail.openvswitch.org/pipermail/ovs-dev/>","List-Post":"<mailto:ovs-dev@openvswitch.org>","List-Help":"<mailto:ovs-dev-request@openvswitch.org?subject=help>","List-Subscribe":"<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>","From":"Ales Musil via dev <ovs-dev@openvswitch.org>","Reply-To":"Ales Musil <amusil@redhat.com>","Cc":"dceara@redhat.com","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ovs-dev-bounces@openvswitch.org","Sender":"\"dev\" <ovs-dev-bounces@openvswitch.org>"},"content":"Add a new iterator that allows us to pop the items as we iterate.\nWe already have a wrapper for sort, add wrapper for bsearch that\ncan be used later on.\n\nSigned-off-by: Ales Musil <amusil@redhat.com>\n---\n lib/vec.h | 12 ++++++++++++\n 1 file changed, 12 insertions(+)","diff":"diff --git a/lib/vec.h b/lib/vec.h\nindex 5e51357de..ff8f69a5e 100644\n--- a/lib/vec.h\n+++ b/lib/vec.h\n@@ -148,6 +148,18 @@ vector_qsort(struct vector *vec, int (*cmp)(const void *a, const void *b))\n     }\n }\n \n+/* Binary search for given key in the vector, the vector has to be ordered. */\n+static inline void *\n+vector_bsearch(const struct vector *vec, const void *key,\n+               int (*cmp)(const void *a, const void *b))\n+{\n+    if (vec->len) {\n+        return bsearch(key, vec->buffer, vec->len, vec->esize, cmp);\n+    }\n+\n+    return NULL;\n+}\n+\n /* Returns the size of allocated space for the vector elements in bytes. */\n static inline size_t\n vector_memory_usage(struct vector *vec)\n","prefixes":["ovs-dev","3/6"]}