From patchwork Sun Aug 15 09:55:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 29532 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1104249iov; Sun, 15 Aug 2021 02:56:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx427fq4hcnV6yN0QPX9JP+VqMzs2aqa2RwrSANn+mJ7LDFb03j2c5mZaoMooF7SNTXpGDH X-Received: by 2002:a17:906:3745:: with SMTP id e5mr10892313ejc.400.1629021417373; Sun, 15 Aug 2021 02:56:57 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y2si7305557ejr.90.2021.08.15.02.56.57; Sun, 15 Aug 2021 02:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=l3uQJOO4; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1B17A68A2BD; Sun, 15 Aug 2021 12:56:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-oln040092067105.outbound.protection.outlook.com [40.92.67.105]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 29E55689963 for ; Sun, 15 Aug 2021 12:56:21 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AC8nuMVLZuw02qflxst6TEMapWN1EogR1U7Q/HUNKvm2THJfEAZ57+bIdS2IRUe4wXOmLxsofN+yrSvOA2azVVi5LZr03v9levyGzsTfevoAev6p78oTcef69YcsNJ75RDg/butYxW6eLifJ3lFYnqryUbczd+LK8CrWvNONT/6cdbfWh7a/NfK5aWYmFBk4U9HZ+0lmSZkdduT5ZxbnBX52GhT7v/SCs3cfdqf/sXwF1yWPifdR3niqH8wLPBCqpTCwuTl2W/vvJ5E+/FnFI6DDxfQjwQzHXrqgXoRWp/KZx78TQSfNfKQSWbDY8FoLShTbVB/iGwsl35fr2zc3ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=idslXOrUQgzk7l9ZMKEc9MgkG9sgNmRpWRMRci1z7Ho=; b=jXC6jP5jc6Yqu/gNoBZjI6E6pcaYCI794ZU9s9vD6FWf0amMPqmiPei1WWd7++5FxNwGAgJFWGDIwrOQAKmyxIJNzH0S0IcsSVIHtCPwAc1+HYwCSgBXYQvKhSVBjx9Vad9zvBJut8zkr3UK/9lvYOVqzmDpz4FkKDd6hGlp1mw6mfbWguEOTSSc6JziwF0dWKdTNQBtZCknl+Z+yWmdVxTLy7Gh59pKwhwgmNo0l37TYHCzf5ej8x/RhMaIBVP3Bxr796ymBnOJCupjqL50MZU9BXDkfByZYZIMYvkumGWXBZMJAVEmnb90gSp9S5+31AzDiGB5boP/v6+sYiF13A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=idslXOrUQgzk7l9ZMKEc9MgkG9sgNmRpWRMRci1z7Ho=; b=l3uQJOO4JogXT12Iec076gkX8DWM4vInBF5gREOFsmaGpK5fIiyikYi/U50PuZMILkJx+da1/4U0h9/SgWYgHjiT+1qXFeUpYJC6JLvAONvNUj0LC4Tx0oLC8d0CkNveUrBXxl/XQ7m2/55jg/QZbuSIlq08ApcRR4lwX24+ndgUnk0CC+Br8NTOx2XCy5raKRD2Hayq6pn8m6nQAmjTk88j4Vi5zE2r+6mBwXIVEqMYwo2wMWey5zKs4B5X2geUg4BnE1y5WHdBKaqe1ANuMUCTma3Vmg4Hj19cJvhrZ0gv7BRhtDTYyWLB4ysNZnSg8z8+ukw8VTzvDUXAkQ/g9w== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5542.eurprd03.prod.outlook.com (2603:10a6:20b:f8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14; Sun, 15 Aug 2021 09:56:09 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ded:bace:bc7:e91d]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ded:bace:bc7:e91d%3]) with mapi id 15.20.4415.022; Sun, 15 Aug 2021 09:56:09 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 15 Aug 2021 11:55:36 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [FdOkD3ACgW1PiVr5+AcfvXW/H2c73EYF] X-ClientProxiedBy: AM4PR0202CA0005.eurprd02.prod.outlook.com (2603:10a6:200:89::15) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210815095538.2116202-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4PR0202CA0005.eurprd02.prod.outlook.com (2603:10a6:200:89::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Sun, 15 Aug 2021 09:56:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e6aac5c7-da59-452c-7a62-08d95fd2e85a X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNVjun0oR/i13HcFhFL6IneNiVUllv0s61Qnl3I+gWvYoR+hZJwES3fEYjkKSlYgZ+LzhkBnGHsWG8Qrh70Kgu7JJO9/LPLuEgPv3WNpd11XlwEedjhCnYoQtU0fa98l6d+k5+rMxwHLaVjghINCSN/XmqbYNl4zdOuAvfgGOOJBK7bpodZJqn6MsxAZG++ZNJCC/5bZGMt0bmUzksjLNuG7QPFr8zOEj+PiVrsZZnl9ATNiI/v7+Q5TLhecbfa/K3K51zrQ/ypQMvhJd002wPOSBwNqTWigJlv5yWYjTITsbfnJDxdkpEsYiUCquT10HS9JcENM8mPK8fcZI5xlXMkB2FO2oTuLgSKRsPVDDPAtUQnpZWxb1XeNgaqAp9ft22uLRSx+GRzg2HS5qxELCKO6t0zkapbn+W72DbsE+O6tlQ1zTjAn86JA1lVmlQOzhSo2cMKYzeeCPUWY70tpdvirjbVvEQ8e+KY4SHtPTH1khODN+S0A9Bee2LGlLFnnNjixBLv8scQD1FJSdp69Bcw29Dk5v5Ykdo9BbjY1ZNMOWrZAFjjdG/b4b8Nlx6H2Yk1uQ8SvxYzpepH+zsuiKiSp6AgfGoTNWl86RwBCy1HYTDUUHsL2pUMeQqVpqFA+oVLU3vWC29MRo85OzRMAmNr/D0FTC6TPUru++jbnjhZgz1kdYuBJ+BVD1i2ZEujjksYeuY5i70Q9KR98YvSUo6m5B0WPLjDBrUI= X-MS-TrafficTypeDiagnostic: AM6PR03MB5542: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gMdh+YsyfY3itn3hQOY0uYulfiLHNTA9DHmtJMAFdQYr7JQ5gHXewHR90xQOw2yOMjUcFFalV6ddde8fBnKJ217tAXcooaeTwcYieoGUFEaGcKkhyWtagm/bfbNPLl4YBljFVtyoRb706BN8w1N8e+yZzqDLJvc9gqaI4wy7cVvZsIvoS+VpvfLxGpbmaPuPZaAwqXAbdBLe4hGyQu0jBpWKCGqITzX9oOmrVmPwHeLiNi2qiZSs5n0hDSnOL395cuYMuPFUUxjRfsQqx2tzVjyupRFTM/nxatG96obrm0OwRqdQan0eGd3egV+a6TVy6XYYIz33D7HH86zKDnwsKEIIMttlU89z68p3wB6Nw9Lx3QsC8/sX7dRkZ9nSImstikMEfROGD+eZIAMnfVJaSGYDRPAhMrHnzLpaRK116ZLrRbUxquxhhHIsMiiuWGHk X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Q/B/DUXviAHSHHGN6B7ZekgTELk/C75PifIjQ+ZTvn/f2B+QGNtbS0FfcbUKn/FpmVdHlsRKPvi5I0VRfuhv8boL4Gu4LH1LX0raHSRZbM7xfn1KDoSr2So1lLQ8Ma5C8RrQvPhRiBhSCfU9XVCnsQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6aac5c7-da59-452c-7a62-08d95fd2e85a X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2021 09:56:09.7581 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB5542 Subject: [FFmpeg-devel] [PATCH 08/10] avfilter/formats: Avoid redundant counter 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: oWw/A8GIklMm The ff_set_common_(formats|channel_layouts|samplerates) have to free their list in case it doesn't have an owner; therefore they tracked whether they attached it to an owner. But the list's refcount already contains such a counter, so we don't have to keep track of whether we have attached the list to an owner. Signed-off-by: Andreas Rheinhardt --- libavfilter/formats.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 9e39d65a3c..cc73c5abcb 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -623,7 +623,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) } #define SET_COMMON_FORMATS(ctx, fmts, ref_fn, unref_fn) \ - int count = 0, i; \ + int i; \ \ if (!fmts) \ return AVERROR(ENOMEM); \ @@ -634,7 +634,6 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) if (ret < 0) { \ return ret; \ } \ - count++; \ } \ } \ for (i = 0; i < ctx->nb_outputs; i++) { \ @@ -643,13 +642,11 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) if (ret < 0) { \ return ret; \ } \ - count++; \ } \ } \ \ - if (!count) { \ + if (!fmts->refcount) \ unref_fn(&fmts); \ - } \ \ return 0;