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 3C22645366 for ; Sun, 25 Jun 2023 12:08:00 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 11D1668C16E; Sun, 25 Jun 2023 15:07:58 +0300 (EEST) Received: from out203-205-251-59.mail.qq.com (out203-205-251-59.mail.qq.com [203.205.251.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9C538680969 for ; Sun, 25 Jun 2023 15:07:50 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1687694861; bh=tee2A60w2Pl7I9bhMGjlrmxOrt2EhXtcSGFB4oj1+Gw=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=Uz4xz9WKXHDvAnhhTx0Avd701GgFqCD90KhFX8GB22VjLR+11F0CcmYCAOOdJWxbE nfg1NUyPY35aXN6FU5iapwSPIQl/agyPsSfMaHOxSfY7b8UIJciqyQs5yCZCv1lJno Oa6dzMexWA/ftipnNBWCH6gIMZ2vSO5ptTnR6rWE= Received: from smtpclient.apple ([113.108.77.66]) by newxmesmtplogicsvrszb1-0.qq.com (NewEsmtp) with SMTP id 1E8852A7; Sun, 25 Jun 2023 20:07:40 +0800 X-QQ-mid: xmsmtpt1687694860tu4re23qx Message-ID: X-QQ-XMAILINFO: MFWpArBVhhGTb7xTRyf8ELMT0fQF8ZcYWVX9zUkDzJi850Ck9s3YbZDiyEUUkK Fo1Ow+XksM12glRLsKLsgkL0zoU9TUiO0vaJiDilJWjJ1ccfiQvPaf/jbiIYg+XMe4lxk8YzrGjT aJ31IbJWnQVfklUqRqxqio8YAUO91W9QT/wYukPU/QJsl3ExQBr4n7m+nYCfhkV3/fR7i3njeYnm RPLQBLPsTVSHnkJIyomVv6rQ9FtljD88YBp7jq+n+DqRyFb9WXYvZ0eAq6HVZmSJAAu3ufO7AdVO 7U+OhAlrAotX1g0q5JYzfdvHGBAM6zyBdB0KkGb90Tf33y4ZqnuYzxfEpRexa31hSpWpA3Psm8kM 8Ce8WPd5prQhO8M35bbIYkymMLiPHGCC7l1xxdcHsNFJjQwON/4jmaCQdBiM9zI0MgdLDNZREdig 9Dmzz2UApehg+u0HWLSgTA+lGiLwJxDaaCOCwsKiDfDsIcrN57ml1S6qrL5TXt6H5bqMbZMrolsk r+RAA9S3p49Eh+iSI14sOxYkxBLq5lvFK1B6cDHByt4Eugftw24DjUIZoBpiPHvr5uASKZ9EspIO wpCWVH0jtydCe6jG79PLz39FLdpjlqqf6nO/hPQLBwIMK6iWDnr3oEb/pmnnDCeyESoFTF2YRWQ3 wUxMDCohYN7yGkKM8erTwIj5JKnaaZl0LmsZBBR9UPE7bAzSMlh/js00A93LYCqt0jJlzK0VR21+ TkivekWt8gtBOZZFA4YQf02CC7vnJ1qEVfo5I+CfkPWXQ3c9EGmpbPK7qn6/wOmpo3/hSqL50R1I uptQYr3CzQ+92xRTPtzlyB54ePSpRRJVHEo8oPKLf9NPnraz5fkhWMz2VH6Q4K25eC3RmepfZwz+ qCODLwQdnW01XApmxcgRLmu7+09WKaHZ+LPqFXK29LuJyuzP3XG/Ma8E57kCi+pGgNwj3sqDjWOx WsKFnitDYjo1OZfnsGGxvW3RLTUv1RACsoSBiAynE= X-QQ-XMRINFO: NT0eAOK/sSMcVWZR8HXaz7ha97UQQ6B0Jg== Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) From: =?utf-8?B?InpoaWxpemhhbyjotbXlv5fnq4spIg==?= In-Reply-To: <20230501114456.13898-2-epirat07@gmail.com> Date: Sun, 25 Jun 2023 20:07:31 +0800 X-OQ-MSGID: <85B78ED5-C9D6-49DC-A6E0-1E7D91EB2C3A@foxmail.com> References: <20230501114456.13898-1-epirat07@gmail.com> <20230501114456.13898-2-epirat07@gmail.com> To: FFmpeg development discussions and patches X-Mailer: Apple Mail (2.3731.600.7) Subject: Re: [FFmpeg-devel] [PATCH 2/3] avformat/tee: use 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: > On May 1, 2023, at 19:44, Marvin Scholz wrote: > > This is a well-defined way to "steal" the value of the dict entry. > --- > libavformat/tee.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/libavformat/tee.c b/libavformat/tee.c > index cb555f52fd..70f3f2eb29 100644 > --- a/libavformat/tee.c > +++ b/libavformat/tee.c > @@ -157,6 +157,7 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) > { > int i, ret; > AVDictionary *options = NULL, *bsf_options = NULL; > + char *entry_val = NULL; > AVDictionaryEntry *entry; > char *filename; > char *format = NULL, *select = NULL, *on_fail = NULL; > @@ -171,15 +172,15 @@ static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave) > return ret; > > #define CONSUME_OPTION(option, field, action) do { \ > - if ((entry = av_dict_get(options, option, NULL, 0))) { \ > - field = entry->value; \ > + if ((!av_dict_pop(&options, option, NULL, &entry_val, 0))) { \ > + field = entry_val; \ Nit: You can remove the extra level of parentheses now. > { action } \ > - av_dict_set(&options, option, NULL, 0); \ > + av_freep(&entry_val); \ > } \ > } while (0) > #define STEAL_OPTION(option, field) \ > CONSUME_OPTION(option, field, \ > - entry->value = NULL; /* prevent it from being freed */) > + entry_val = NULL; /* prevent it from being freed */) > #define PROCESS_OPTION(option, field, function, on_error) \ > CONSUME_OPTION(option, field, if ((ret = function) < 0) { { on_error } goto end; }) > > -- > 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". _______________________________________________ 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".