From patchwork Wed Aug 11 19:00:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Witten X-Patchwork-Id: 29433 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp45387iod; Wed, 11 Aug 2021 12:01:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHcVIJMggKM8WCByNcaHkGcwjoiCZuQn7bd7ljlBALK7DI0h4QE77+YYd2MpPNF/AUK2tR X-Received: by 2002:a17:907:9604:: with SMTP id gb4mr16610ejc.142.1628708495011; Wed, 11 Aug 2021 12:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628708495; cv=none; d=google.com; s=arc-20160816; b=Gt+J/rRUJZmUKlLHFlqVhw6CpY+/Fuf82l10Jxbns+lSwqv2n+93PN+9ZS9ZDWAJiT 62iVebfEu0JXLAOO1YBU/gEoZ43AmrLrMGN3YxqD6Qr79peJHSt7goDRH9L6v+eRhHCe NRq8dAjm0qqUzplcODNRpvPF487XpW3eLwE6kA6K8tGjpBJOvPoHtT1fQw6EcmxZBBzP Ahnh205BIyoXjnz32Sdw3fB0bYMNGbonNdq9T1mHMs2Z1jwuWSTRg5f7HAIij5HtQV8u iZR0IAORCORi1VGMpXdmfyUKr+Tkyv3EOu4FBkaSaJkrwsWcGoDavtWObcHlbeuXt9eD 77uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:to :from:date:dkim-signature:delivered-to; bh=FBmrxwZcNhuFCZz42iiwb6K+f7wdR+/JIJ78YzekvOQ=; b=mAbzq/zu3lphvy+PrQ0hsln3hMcja96mgDyo1tvRmzZK2HJAC2yxdFz/aQsbCmw1/3 H+nRQOtWoY/2LgDJwv4W8PCwRtUi0FvagjkfzfNcNI3Uenj0tDVeeWaFK5labiLAMvVz ChtdmJ1IAh5HzPtR5EP4mJOhdHuasmr+JTdlo75mVsfHAHHGMpAwGOycpIyNxjJNrRZs KWSjooBHtpsLnOjFY5kr3dgDLjy7lvFBz//U9hbrA9QdfQolOVWbgTQ6ytBmnrOCXeby 35cE2cynafA2yYGKJ3HpLZtFUDv9AuNrBbDxJ0UZkWhB933yYFF8SnEh2og8W4Nw69WJ mdQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=JbVqCQAP; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ka11si24430654ejc.367.2021.08.11.12.01.34; Wed, 11 Aug 2021 12:01:35 -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=@gmail.com header.s=20161025 header.b=JbVqCQAP; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5F1C568A543; Wed, 11 Aug 2021 22:00:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7969668A4D5 for ; Wed, 11 Aug 2021 22:00:50 +0300 (EEST) Received: by mail-lj1-f174.google.com with SMTP id e11so819274ljq.4 for ; Wed, 11 Aug 2021 12:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:date:from:to:message-id:in-reply-to:references; bh=fxFlruUzI1NW58mphFQlcgUroZcfeYe35ICLl7aUW7w=; b=JbVqCQAPWfdZkz0mrToX5XA6E0wFDryNNcJYoH9lk9Vlw8x6xHPCymNE0tnSjglCGH /7ZcZnyAv6ReHDdCbXne2KNBdF0ytPWcJ/Ro2ipQgKAUXP/oVhqdvjQEWsbNUH/BSJZ3 klNrWMv0UIGRjvaforOQwKTJ7jIhrBb5XD6iEpy+Eu96SwNNvSAhf2Apu2a5Fu7Wrn36 L4dCk+La9aav7NXmkBmUXjBoM4c3nu/o8KVsuLQNSbt9isF9vGShXjv4pu+sGzFNOE+u unVdaW+nYfwM9o4fKVCDVm5Mv4DHYLnDMzBxG6/nIitXUqstQeWvxCBv7EtLDFyih3O9 BHIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:from:to:message-id:in-reply-to :references; bh=fxFlruUzI1NW58mphFQlcgUroZcfeYe35ICLl7aUW7w=; b=suLzZkm7ePqCCi5K886gRqvRGpqEzJXObktU9qy6y747yC+tNLRUVC5Ty0I+rXWd3g nXkk2Q+gjl//WE9XaG27l3FlTLEMv2NU1DgCcdK2ySJol725g9szYcisFDNJ6QdtzF8U lBb7vOwVnrqAi4qY0ZvFGjzCJy7vPQmJ4thMbCetIfd2f2mgET63F9Y6MP1sLtkcrdAf hJSSmWx0o10tUxLZ3qQVc9m1/Us6R3cUplHBmW8eM4FFa7rTVjKzxVQRdqKwWNKpS7ro AlTUn9Njays2UUZG5agaNpveQzEZ2szyT0WRA3Yrct9oaUa9LgnP8SWSzeND5jPK5W3L WL1g== X-Gm-Message-State: AOAM530aYb6IESECJNvII/NoctRZUra0Mo5qQJr6UEw8HZ60fj7C7OoF qmV1YlxDmQr41tqiSiClgBroetQSpVPcaZgehajfUg== X-Received: by 2002:a2e:a4d5:: with SMTP id p21mr123145ljm.214.1628708449367; Wed, 11 Aug 2021 12:00:49 -0700 (PDT) Received: from gmail.com (tor-exit0-readme.dfri.se. [171.25.193.20]) by smtp.gmail.com with ESMTPSA id s27sm16043lfs.279.2021.08.11.12.00.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 12:00:49 -0700 (PDT) Date: Wed, 11 Aug 2021 19:00:06 -0000 From: Michael Witten To: ffmpeg-devel@ffmpeg.org Message-ID: <7668e56bf2834e0683cc7ffc78f5f2b4@gmail.com> In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH 2.4/3] libavformat/protocols.c: avio_enum_protocols(): Consolidate initialization of 'p' 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: WH8gMOE+7k5i Now that the label has been moved past the initial assignment of 'p', it is possible to consolidate both the declaration and initialization. A typedef is used to simplify the declaration of 'p', and to help the reader understand what the purpose of 'p' is. --- libavformat/protocols.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 7e90cb067d..5e4bf5cbae 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -93,10 +93,8 @@ const AVClass *ff_urlcontext_child_class_iterate(void **iter) const char *avio_enum_protocols(void **const opaque, const int output) { - const URLProtocol *const *p; - - p = *opaque; - p = p ? p + 1 : url_protocols; + typedef const URLProtocol *const *Iterator; + Iterator p = *opaque ? (Iterator)(*opaque) + 1 : url_protocols; iterate: *opaque = (void *)p; if (!*p) {