From patchwork Wed Feb 24 11:53:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 25963 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 BB7A544B5C7 for ; Wed, 24 Feb 2021 13:54:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A6B7368AA24; Wed, 24 Feb 2021 13:54:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BC3976807F6 for ; Wed, 24 Feb 2021 13:54:27 +0200 (EET) Received: by mail-wr1-f43.google.com with SMTP id v1so1609783wrd.6 for ; Wed, 24 Feb 2021 03:54:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=52Q2gWGxLsPn63DQNyGcUWLl3/ONZ5fpXKBmAjW31no=; b=ZLPAaAh9x6YzYuGL4iY7V/EySw/vzL26RnVwuXNFzQlro/wIeF3MM2Evgy6tDSBESz 38b8V1+Xvp+zCT3IPfkgQbNMcw/yBt9AHaP+3n6+d373iArH2YX/2W+dYsBEfJwl9xJs MTrRECVtLs8Inh5nKQEYTGKR+NMAt8dF+R+Q5+avhZQtWZQjaC2fubvmXcJQC2RYBHtx hlIVQf2KBfJNiweFdkFqmeVpdBEcviW8G9zszqpRzeHM9JlbL04DxtNt11T8XFNH33HF bV2eYaZaZGxibJkqziFsO3ZyT3W9Jl3uOM4GREA6y1C2yDOGq91MJD57CytHncZpvtF/ inRw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=52Q2gWGxLsPn63DQNyGcUWLl3/ONZ5fpXKBmAjW31no=; b=D1FnZdVM8ZsooH5MFPIm3KLXpPHgWwHrxbzTZ+13uqPLWHufYMcyzkYBvGIy1LlQmL xDu7FBik1yGsymuS7Efjdr7Z1myyJ4cxZL3H+JDH5+cd3We0y55UlvfA/FZmX8aRFTHY tqGe4dYBTG+TH85X3Ce+/loTi8dkW1/M1Xrdu9X12uCVS24Zu+cajWE9Z63voVZFJk/r vlBcS8ZUw+CQMKc5C8n/WcuPoNutjDucl8RQ/Qpbivw/Hwc4TdW1eU7fN0tzhYzGvgW9 y0ybqZg+XCGOop/RZ7eLb/rjWt0eFu6pfTaQxCnWXR85ET1N1n7cy7AQx4MCQOuIV8iT fsPA== X-Gm-Message-State: AOAM531BWHTmpV9FD8IzoDgE+e46IPYVAU00V5tOXUYS73wu2dcQK5hU 7kq9NAL2KsE5tiSFW/aXVMjPCWWhUvE= X-Google-Smtp-Source: ABdhPJz/UqL42/aXORXV+lEkgA0y3lVnherHgXLyp5geIgrY7s/fCSdI+KUFqoC9MuEBKUvBOAkZbQ== X-Received: by 2002:a5d:4ec6:: with SMTP id s6mr14421154wrv.416.1614167667093; Wed, 24 Feb 2021 03:54:27 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id k15sm3911776wrn.0.2021.02.24.03.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:54:26 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 24 Feb 2021 12:53:38 +0100 Message-Id: <20210224115341.794293-12-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> References: <20210224115341.794293-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/15] fftools/cmdutils: Use av_strstart instead of strncmp 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" It makes the intent clearer and avoids searching for a delimiter in advance. Signed-off-by: Andreas Rheinhardt --- fftools/cmdutils.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 4eb68d2201..fe253d10a4 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -215,11 +215,9 @@ void show_help_children(const AVClass *class, int flags) static const OptionDef *find_option(const OptionDef *po, const char *name) { - const char *p = strchr(name, ':'); - int len = p ? p - name : strlen(name); - while (po->name) { - if (!strncmp(name, po->name, len) && strlen(po->name) == len) + const char *end; + if (av_strstart(name, po->name, &end) && (!*end || *end == ':')) break; po++; }