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 EFBCA43BE7 for ; Thu, 22 Sep 2022 02:02:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9868B68BB4D; Thu, 22 Sep 2022 05:02:35 +0300 (EEST) Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9A01268BB37 for ; Thu, 22 Sep 2022 05:02:29 +0300 (EEST) Received: by mail-ej1-f51.google.com with SMTP id r18so17800148eja.11 for ; Wed, 21 Sep 2022 19:02:29 -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=rfUeWQ8u2MBBR2SdnOLSMNnBIKtxl9XpwaTWhlqiek4=; b=f54A2J8Gk8Z3wWWblKLHJEL45UAb9ygq5XstgmXcRfnmy1INsX4qAHNM/J5s2Af6ci pmj4trm5BgRwhgqOV8ynJCKagZ12DjL2CwqoZOogJ8b1R/2/aOm/LSPZ3hGdyW1PdYy+ ajfB+46OF/Ap/3W/IR2lMEgzFdCooyzVzsIHIyRTjPvcPlXaAQC/UOxOehIWJQZqjMtx h3cbWiXSL7kfvc3baqNSymUUiO8zxfW8AL8nKZcB7biFTPEtvk5I5K2rtgdj2KpF0YlV W+9tyEyd0RFciA7JQUGsx2kkbzq6PhXrShNZbXdDdrBHmF8OTjJOjly3CqY3ahSUfUL1 TV7w== 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=rfUeWQ8u2MBBR2SdnOLSMNnBIKtxl9XpwaTWhlqiek4=; b=5G1bzXC54p3jx23GKAIJxCyTmM3T1/r+BpCW1tMRefY7tLGKBKe6E0O/aKCFnTNaiZ A/GTdYH2IOyC+MbOHYb04tnQ3npff4t+v0S9qxB1g6tFVZ6cLxa6Sgiouh+Z2gblQMyf KcV16fzvJCYMARdxOmeXc4Ng5V77mcZiiSerrmdFFBVTcVXaxCLKdgsh1PX0VG7aBbc8 J/jEmcF22t3blHiK/Wdl7tOjLQEjzNgkoxZoGrmAILM56pKahsmRmr5ysKX5b7v25aHV cpic33B2RTvzZb6puCHPoJfjUgTvuQDQj2yNW6ODXrbm3uy1h6ia04XZedOBChnfaZCF anTw== X-Gm-Message-State: ACrzQf39gw4d+4NLEPQu/OOWbVS0SS0XJ1RTDJcCBFvf/A3HqWld2LDt G7rWt8ZQisZFKI0O2kgNCWID6Aa5K5A= X-Google-Smtp-Source: AMsMyM6jKSyjBepHyQ1zaTdRG5SeJSYywZUmRjqIrNH8BAfkwYc8ri4zbMdOLGIZeRHZ39EEizj0GQ== X-Received: by 2002:a17:907:6d02:b0:781:c741:ce0f with SMTP id sa2-20020a1709076d0200b00781c741ce0fmr897020ejc.762.1663812148986; Wed, 21 Sep 2022 19:02:28 -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 e4-20020aa7d7c4000000b0044ec76521a1sm2792794eds.55.2022.09.21.19.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 19:02:28 -0700 (PDT) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Sep 2022 04:02:16 +0200 Message-Id: <20220922020216.46589-2-epirat07@gmail.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20220922020216.46589-1-epirat07@gmail.com> References: <20220922020216.46589-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] 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 2f690a5b8e..1a348d6710 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -60,18 +60,14 @@ 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; + AVDictionaryEntry *entry = (AVDictionaryEntry *)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 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".