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 8A128460F4 for ; Mon, 5 Jun 2023 10:05:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AB94F68C3DF; Mon, 5 Jun 2023 13:05:00 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5B09F68C2D7 for ; Mon, 5 Jun 2023 13:04:54 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B5C792404EC; Mon, 5 Jun 2023 12:04:53 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id LwSvqDOjaQW0; Mon, 5 Jun 2023 12:04:53 +0200 (CEST) Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 16CB8240177; Mon, 5 Jun 2023 12:04:53 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 37A521601B2; Mon, 5 Jun 2023 12:04:52 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20230501114456.13898-1-epirat07@gmail.com> References: <20230501114456.13898-1-epirat07@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches , Marvin Scholz Date: Mon, 05 Jun 2023 12:04:52 +0200 Message-ID: <168595949219.3843.10239594281178419577@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/3] avutil/dict: add av_dict_pop 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: Quoting Marvin Scholz (2023-05-01 13:44:54) > diff --git a/libavutil/dict.h b/libavutil/dict.h > index 713c9e361a..b2ab55a026 100644 > --- a/libavutil/dict.h > +++ b/libavutil/dict.h > @@ -172,6 +172,26 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags > */ > int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); > > +/** > + * Remove the entry with the given key from the dictionary. > + * > + * Search for an entry matching `key` and remove it, if found. Optionally > + * the found key and/or value can be returned using the `out_key`/`out_value` > + * arguments. > + * > + * If more than one entry matches, only one entry is removed and returned > + * on each call. Which entry is returned first in that case is undefined. > + * > + * @param pm Pointer to a pointer to a dictionary struct. > + * @param key Entry key to match. > + * @param out_key Pointer whose pointee will be set to the matched > + * entry key. Must be freed by the caller. May be NULL. > + * @param out_value Pointer whose pointee will be set to the matched > + * entry value. Must be freed by the caller. May be NULL. freed using av_free() Should also mention what the function's return value is. > diff --git a/tests/ref/fate/dict b/tests/ref/fate/dict > index 7205e4c845..bdb097cb03 100644 > --- a/tests/ref/fate/dict > +++ b/tests/ref/fate/dict > @@ -48,3 +48,15 @@ Testing av_dict_set_int() > Testing av_dict_set() with existing AVDictionaryEntry.key as key > new val OK > new val OK > + > +Testing av_dict_pop() with existing AVDictionaryEntry.key as key > +test-key: test-value (Return code: 0) > +(null) > + > +Testing av_dict_pop() with nonexistent key > +(null): (null) (Return code: -2) I don't think anything guarantees that ENOENT has to be -2 on all platforms we support. -- Anton Khirnov _______________________________________________ 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".