diff mbox series

[FFmpeg-devel,1/8] avformat/vorbiscomment: Don't compute strlen twice

Message ID AM7PR03MB666011F89AFF7665855CF0918FC49@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 64020dfe08f7f2212571a2c2ef10ea366a492a95
Headers show
Series [FFmpeg-devel,1/8] avformat/vorbiscomment: Don't compute strlen twice | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 23, 2021, 1:13 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/vorbiscomment.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Paul B Mahol Aug. 25, 2021, 4:06 p.m. UTC | #1
lgtm
diff mbox series

Patch

diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index a929634cc0..13ee065a44 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -66,9 +66,10 @@  int ff_vorbiscomment_write(AVIOContext *pb, const AVDictionary *m,
                            const char *vendor_string,
                            AVChapter **chapters, unsigned int nb_chapters)
 {
+    size_t vendor_string_length = strlen(vendor_string);
     int cm_count = 0;
-    avio_wl32(pb, strlen(vendor_string));
-    avio_write(pb, vendor_string, strlen(vendor_string));
+    avio_wl32(pb, vendor_string_length);
+    avio_write(pb, vendor_string, vendor_string_length);
     if (chapters && nb_chapters) {
         for (int i = 0; i < nb_chapters; i++) {
             cm_count += av_dict_count(chapters[i]->metadata) + 1;