Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marth64 <marth64@proxyid.net>
To: ffmpeg-devel@ffmpeg.org
Cc: Marth64 <marth64@proxyid.net>
Subject: [FFmpeg-devel] [PATCH] fftools/opt_common: remove dead code in print_buildconf()
Date: Tue, 12 Mar 2024 17:41:19 -0500
Message-ID: <20240312224118.2436860-1-marth64@proxyid.net> (raw)

I found this code block when looking at this warning thrown in my
compiler (gcc 11.4.0 x86_64-linux-gnu):

```
In function ‘print_buildconf’,
    inlined from ‘show_buildconf’ at fftools/opt_common.c:260:5:
fftools/opt_common.c:226:49: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  226 |         remove_tilde[sizeof("pkg-config~") - 2] = ' ';
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
fftools/opt_common.c: In function ‘show_buildconf’:
fftools/opt_common.c:214:10: note: at offset [10, 11] into destination object ‘str’ of size 1
  214 |     char str[] = { FFMPEG_CONFIGURATION };
      |          ^~~
```

Upon further inspection, I am convinced that remove_tilde does not serve
a functional purpose. There are no other occurences in the FFmpeg
tree via grep, and we are setting a value in it but never using.
The original code traces back to 69cf626f9c1ba29e66ff62e2b835dcfc3031db8d
and even there, I cannot find a purpose for it.

Remove the variable and it's related loop where the assignment occurs,
which resolves the warning.

Signed-off-by: Marth64 <marth64@proxyid.net>
---
 fftools/opt_common.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 947a226d8d..e4a63f565e 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -212,7 +212,7 @@ static void print_buildconf(int flags, int level)
 {
     const char *indent = flags & INDENT ? "  " : "";
     char str[] = { FFMPEG_CONFIGURATION };
-    char *conflist, *remove_tilde, *splitconf;
+    char *conflist, *splitconf;
 
     // Change all the ' --' strings to '~--' so that
     // they can be identified as tokens.
@@ -220,12 +220,6 @@ static void print_buildconf(int flags, int level)
         conflist[0] = '~';
     }
 
-    // Compensate for the weirdness this would cause
-    // when passing 'pkg-config --static'.
-    while ((remove_tilde = strstr(str, "pkg-config~")) != NULL) {
-        remove_tilde[sizeof("pkg-config~") - 2] = ' ';
-    }
-
     splitconf = strtok(str, "~");
     av_log(NULL, level, "\n%sconfiguration:\n", indent);
     while (splitconf != NULL) {
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

             reply	other threads:[~2024-03-12 22:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 22:41 Marth64 [this message]
2024-03-12 22:48 ` Andreas Rheinhardt
2024-03-12 22:53   ` Marth64
2024-03-12 22:57     ` Andreas Rheinhardt
2024-03-12 23:02       ` Marth64

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240312224118.2436860-1-marth64@proxyid.net \
    --to=marth64@proxyid.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git