From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1340C44064 for ; Sat, 24 Sep 2022 14:37:30 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0F25468B4CC; Sat, 24 Sep 2022 17:37:21 +0300 (EEST) Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CB7468B6AC for ; Sat, 24 Sep 2022 17:37:14 +0300 (EEST) Received: by mail-ej1-f41.google.com with SMTP id 13so5994405ejn.3 for ; Sat, 24 Sep 2022 07:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=OqhVdOIJGE0bLt7Zvcq0qVDWcpr9akZSMX5yMWcmLeY=; b=IVwEwus4urZS/7iUnFpcm/aJQr5R1qbZVRwiCeeyaoDF7KCdj+sVKUw/PDrlbEOeFo RnjYTBcZKf1W/4SLqJlPnHKQNiC1CIec0JnCaeQXM5kX2XhNevJPt8eu0yOxtmFr+IhD u2f6td/8re2vJVwt1tbZ4Q8JWFVR/R21ox4CXJs+x9Nb8b9MUAcPOznmIEDAeaxY53qj Q8+UJY6mZ0NuI3an59bpz1AZLXq8Lurj1181TkHzNZwV49zcQRDa7JCg0LiYRsYLXaF+ TEYM+h47ed+WpJ9UDknzU+3hOm3/UA2snuN9PEE7/1j0SE7wLXt9BHjBKi/UV4JjI1bp ugSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=OqhVdOIJGE0bLt7Zvcq0qVDWcpr9akZSMX5yMWcmLeY=; b=7ehPcsx9DKOjNPX8V/LT5UJykFaV6Hi/8/omA8DSPbHXexW6hHxQq1BUDL1LNQYfkY Yb0kHcV/wttLjkkGNePy4xvJv5ORBxyY9l4bSKz5jgw+eHhyP4/jF2N32d3lfpTWN1qO hNRAV14xZqJX5EtsGWq7dWxkQgbML0u+Odt1nU2x5jMb6ka1xncklzxrPYJc8NajwxLA Zs8rTnEljVx4JT7Itd5/mj3/Y15fWwVrhHDeNb5egg6fxwnrGV2WuXC46YPkF/rS1vLR 3IILIpxY4adlSsWlyoKnzaiwVyrlVZbVobdVmwur9T8uYyZkBjOQTH5wkMX4IvCDjR0o ovWA== X-Gm-Message-State: ACrzQf1yFWmh19hxclhHMeIS5MsVj/q/l7QyPlD4CErcJz7loGfuk8Rx GZFKrf/fWqeLQvNbo3b3NKtNtMPjC0vsDA== X-Google-Smtp-Source: AMsMyM7VuSyYd13DDEdKTVyw8YRbVEqTdreTQDN8+5Oji3aP8+xnpljpmh8YOB4IzJbFRDkSXivkzA== X-Received: by 2002:a17:907:3f28:b0:781:e093:d0db with SMTP id hq40-20020a1709073f2800b00781e093d0dbmr11212126ejc.295.1664030233676; Sat, 24 Sep 2022 07:37:13 -0700 (PDT) Received: from MBP-von-Marvin.citadel.scalie.me (84-112-104-25.cable.dynamic.surfer.at. [84.112.104.25]) by smtp.gmail.com with ESMTPSA id u17-20020a50c2d1000000b0044e8d0682b2sm7970504edf.71.2022.09.24.07.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Sep 2022 07:37:13 -0700 (PDT) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Sat, 24 Sep 2022 16:36:56 +0200 Message-Id: <20220924143659.74756-2-epirat07@gmail.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20220924143659.74756-1-epirat07@gmail.com> References: <20220922020216.46589-1-epirat07@gmail.com> <20220924143659.74756-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/5] avutil/dict: Use av_dict_iterate in av_dict_get X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marvin Scholz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- libavutil/dict.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libavutil/dict.c b/libavutil/dict.c index ee059d712c..ea03590d0f 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -60,18 +60,14 @@ const AVDictionaryEntry *av_dict_iterate(const AVDictionary *m, AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) { - unsigned int i, j; + const AVDictionaryEntry *entry = prev; + unsigned int j; - if (!m || !key) + if (!key) return NULL; - if (prev) - i = prev - m->elems + 1; - else - i = 0; - - for (; i < m->count; i++) { - const char *s = m->elems[i].key; + while ((entry = av_dict_iterate(m, entry))) { + const char *s = entry->key; if (flags & AV_DICT_MATCH_CASE) for (j = 0; s[j] == key[j] && key[j]; j++) ; @@ -82,7 +78,7 @@ AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, continue; if (s[j] && !(flags & AV_DICT_IGNORE_SUFFIX)) continue; - return &m->elems[i]; + return (AVDictionaryEntry *)entry; } return NULL; } -- 2.37.0 (Apple Git-136) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".