From patchwork Wed Sep 28 10:48:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38434 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp121720pzh; Wed, 28 Sep 2022 03:49:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ViCs61lDFcJ7MSrK5lbgx5VrRbI2jW8RXnbsM9B2631Kr7k5CQbdsK3e18MGdBd1YCPE9 X-Received: by 2002:a17:907:7287:b0:783:5e47:33a0 with SMTP id dt7-20020a170907728700b007835e4733a0mr14034056ejc.449.1664362170567; Wed, 28 Sep 2022 03:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664362170; cv=none; d=google.com; s=arc-20160816; b=IVJG02kQVXkKu+0BgclD7phwwi8cP1Cqljg30L8TIh1aeyNrJQ6MEwu3maBjw2xlSz sQtYbTbVkmIez/aOofzDEIxnvPkR/UFlpHJaz2tpBSarMcaVRePvtthbyILhbF30P3x1 /tcHyJ6PEN9UGhCSpn2psKyN6+Mq2WbSZXgVLEzHQFT56h3O4FpT74NNEl6v2dsdY2a/ 4gFquwMps64C42jaTOYVL8YNL8X04qC2zP1Lk75yaUyGjTeyPLJx1IZa830vJS8Mxtz5 OiNqlq1Z77XwPzT20KA2DHeqWnfu5/iJJi87S5vIyobE3h8m5DKjN+pppPxNrUeWDlCK CZfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=nZlQ8lQNslkGxeFOhnQEjxYEv6MzO9dOHALXj8NmfsQ=; b=yKDJMXyfTqLOQbisgGSPdlU/tx4Xp+yixZrqSXK9XdxFyIMZnV9NwfbmrNZJ4oqbiJ weS7UupcA328VIWGfjGY2JTfLBkZLSnb6iffUSm/SIDappGkVFcmf+36sIdYHCGgzTAW c0ESiYcp//AOMgPOru6r0nteOXJ6EM+bFhtR37/BQmN/PTiOF37wtvw7XN41HC0R9Ldr 5b/gR5O2i+tiRFd/EV/YjjzI5rUcC0uuAPxtavfuaKF4SLtW4eDPzaTNBhFcjPYRrzj2 XZDT/4Rgt9Xt+0paFCqKGBSaNNUJBGi+adCIgEwqlsgeGECZvDnnPVv8xertMxbo7eo+ bvCA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z3-20020a1709063ac300b007819c9c27e9si3894649ejd.624.2022.09.28.03.49.29; Wed, 28 Sep 2022 03:49:30 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F339F68BC66; Wed, 28 Sep 2022 13:49:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 383D268BB56 for ; Wed, 28 Sep 2022 13:49:00 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C7BCE2400F4 for ; Wed, 28 Sep 2022 12:48:59 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id uyxBLNuNubbg for ; Wed, 28 Sep 2022 12:48:59 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (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 "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id CDC482404F8 for ; Wed, 28 Sep 2022 12:48:57 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id B6BDA3A15EA for ; Wed, 28 Sep 2022 12:48:57 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Sep 2022 12:48:54 +0200 Message-Id: <20220928104854.18629-6-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220928104854.18629-1-anton@khirnov.net> References: <20220928104854.18629-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] sws: replace av_fast_realloc() with av_realloc_reuse() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gfZl7O5WIJSc --- libswscale/swscale_internal.h | 2 +- libswscale/utils.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index abeebbb002..1566bb50fe 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -91,7 +91,7 @@ typedef struct Range { typedef struct RangeList { Range *ranges; unsigned int nb_ranges; - int ranges_allocated; + size_t ranges_allocated; } RangeList; int ff_range_add(RangeList *r, unsigned int start, unsigned int len); diff --git a/libswscale/utils.c b/libswscale/utils.c index 45baa22b23..67d1cd9fd5 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -2570,8 +2570,8 @@ int ff_range_add(RangeList *rl, unsigned int start, unsigned int len) return AVERROR(EINVAL); } - tmp = av_fast_realloc(rl->ranges, &rl->ranges_allocated, - (rl->nb_ranges + 1) * sizeof(*rl->ranges)); + tmp = av_realloc_reuse(rl->ranges, &rl->ranges_allocated, + (rl->nb_ranges + 1) * sizeof(*rl->ranges)); if (!tmp) return AVERROR(ENOMEM); rl->ranges = tmp;