From patchwork Mon Apr 20 01:42:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 19098 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D3AC844BBC9 for ; Mon, 20 Apr 2020 04:42:18 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B1DFC68B8A6; Mon, 20 Apr 2020 04:42:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1879868B6E2 for ; Mon, 20 Apr 2020 04:42:12 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id x18so10185092wrq.2 for ; Sun, 19 Apr 2020 18:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tI5XPxD//xO1nUySNKwz+NzCxOO0sFcKw2pPx7yR8y4=; b=iY2jcsNNjCM9p0uY1fN2n2muRMTGXXkES78c++ZuSmh397lMY6Jl9m5Fmhv6GjaGPg PH3RmEJ9UI4LmCjpTRgfyslN7nIjzrXWpLaOmdz+sk2J7XEXssdj7P0Vg/6n8zRyGEAL 2BGy9nOA21H0T8uBNuEZ3Yg/GYeX+/6ht9rsTeC63xroQIsy0uHlBYwC83sfQKURPUvD ts2g4ZOp8RRr2eiqa9+uZFKJl0MjF9JGx41I74NNQjNE0ayFt/bwRyFma9WPLCOCWxnx f9luLRa3pgXeaMR2k7f80G9Rc0HgU7ADyfW/ZXwQLQdoq2pu+V5fDbsUfFPkmTT/ko0v uNtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=tI5XPxD//xO1nUySNKwz+NzCxOO0sFcKw2pPx7yR8y4=; b=qiJhvRM/UdhsRWqrDJHQYsH8w42Jb0Rmt2Nu3P/O4dLjUHAnOH7pqSXjR77XAZCaCG ssOc9+TPsqHueTUCdy4JeO9vBRRhU3jb2YTg+rDU0HAEZAtuH3SR9xK6DpUMUzbe9WMz LewQwb7HhvOcg8DzjxW2XuyLNafMmH6whiZfOCOX8GNUNiuDhEsQIBBNaAIC1b8J3VKJ eNONC58r+YIQgME5iddh3kSAb+RltuXvr9B77/ufHKZKplvXDIEUV0Xn1tH6LVx5nfdq ew5loUqQtu57F1oejUFEY2Op2wiry8nkmyB0qIUYB5LdQTG2TVhi8tXmptK4FPTEAff1 PPXg== X-Gm-Message-State: AGi0PuatVIixjFKv79X9Xhsvi6rPG5dEtykoh+7WP9T//D08L6PosmAh QUyQu4bosOIrPltm+jz9mkORrwAs X-Google-Smtp-Source: APiQypI2sNLstg3/oWb4yrITUaxv9qQmDkZNRrV8hoMGK7mbws3BbDRXsIwaGBHTqSycx/pFsg/aCw== X-Received: by 2002:adf:ef51:: with SMTP id c17mr15735352wrp.130.1587346931220; Sun, 19 Apr 2020 18:42:11 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1ab57.dynamic.kabel-deutschland.de. [188.193.171.87]) by smtp.gmail.com with ESMTPSA id s30sm17234692wrb.67.2020.04.19.18.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Apr 2020 18:42:10 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 20 Apr 2020 03:42:04 +0200 Message-Id: <20200420014204.22606-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/rtsp: Put strings instead of pointers to strings into array X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" In this example, the difference in length between the shortest and longest string is three, so that not using pointers to strings saves space even on 32bit systems. Moreover, there is no need to use a sentinel here; it can be replaced with FF_ARRAY_ELEMS. Signed-off-by: Andreas Rheinhardt --- I have to admit that this is untested. libavformat/rtsp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 0a6462000d..b2b3f32011 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -2526,10 +2526,11 @@ static int rtp_read_header(AVFormatContext *s) p = strchr(s->url, '?'); if (p) { - static const char *filters[][2] = {{"sources", "incl"}, {"block", "excl"}, {NULL, NULL}}; + static const char filters[][2][8] = { { "sources", "incl" }, + { "block", "excl" } }; int i; char *q; - for (i = 0; filters[i][0]; i++) { + for (i = 0; i < FF_ARRAY_ELEMS(filters); i++) { if (av_find_info_tag(filters_buf, sizeof(filters_buf), filters[i][0], p)) { q = filters_buf; while ((q = strchr(q, ',')) != NULL)