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 C417C473CF for ; Fri, 6 Oct 2023 20:37:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F3D0868CA4C; Fri, 6 Oct 2023 23:37:39 +0300 (EEST) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C30D068C8F3 for ; Fri, 6 Oct 2023 23:37:32 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 396KbWED020155 for ; Fri, 6 Oct 2023 22:37:32 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id E7F84EB5BD; Fri, 6 Oct 2023 22:37:31 +0200 (CEST) Date: Fri, 6 Oct 2023 22:37:31 +0200 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Fri, 06 Oct 2023 22:37:32 +0200 (CEST) Subject: Re: [FFmpeg-devel] [PATCH 02/42] avcodec/refstruct: Add simple API for refcounted objects 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 Content-Type: multipart/mixed; boundary="===============3931776339790399272==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============3931776339790399272== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6EBT5m9e/FTm3p/6" Content-Disposition: inline --6EBT5m9e/FTm3p/6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Andreas Rheinhardt (12023-10-06): > Do you mean a template that generates functions like >=20 > HEVCVPS *ff_hevc_vps_ref(HEVCVPS *vps) > { > return ff_refstruct_ref(vps); > } >=20 > automatically? Yes, but better, directly: void ff_hevc_vps_unref(HEVCVPS *vps) { if (atomic_fetch_sub_explicit(&(*vps)->AVRC_FIELD, 1, memory_order_acq_= rel) =3D=3D 1) { AVRC_FREE(*vps); *vps =3D NULL; } } Apart from the type safety, I see a significant benefit in having the free function hard-coded in the unref function rather than having to spare a pointer for it. Regards, --=20 Nicolas George --6EBT5m9e/FTm3p/6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE6ooRQGBoNzw0KnwPcZVLI8pNxgwFAmUgcAkACgkQcZVLI8pN xgyj3g//W4u4Vn1zSB0L9HJzO/Ywj/Mj+8sdLe5/OVg7J2Gv/rvUkHGakuIT+jtN Fh3TcMJ3kxkdU0BkIpiRTrUl1TzkSqGSK77fLKQP6+2Uc//TpYQrOxd4TQSfju3q GrlnAfeGDhcuHj1uSNXAsPiCp7yKV0UEctATc5+uKsorb/azWBItaG+8XRKVFJXq uuvAUg1cti7dvjRTSI64IWCNX1xqMnVQW9Q+YwReGidVEXwPLr1ucURwgChpgUkc ejkVP/ugZNSnrulsnAIIuCcPgzjU9/Pu8dBfxvjNKGLq+Lcqdg5ttCp5IyX5xGAi HPSMsNejrYww2JweVQrE45EaFwdWu7Qwr3k+gyZxPe7XIaS1l+GqCtBE+3iHn9qc biOdME7yWUStZ6Bq7kACHjcSNYAPOfoUKWMGVDBb4lyhlx4JtL7I9MhSC1ZSgO5e oOPsS92kGARKRGTC0LvBtzHUUQUnWFXrEHkgQzcptP6ONo7LaM/GDo44fNgrXIG+ RLB0uGetO6U6vzyvR3yV5R1Sx/JMO0+g+88LsG+Y38xR/vxYljdYZuZE1HlHmef9 A9vd2izmrbN+53ZGMBTiKYfShog4TDAIBsjOnrqnz54xB7YnqqFK+SdB6FLA8NKJ QgSnYpANh8PxjlMlYnAF2kQ6stlrTZsdj3H2HDHBX4PlubqPbM4= =D9B1 -----END PGP SIGNATURE----- --6EBT5m9e/FTm3p/6-- --===============3931776339790399272== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============3931776339790399272==--