diff mbox series

[FFmpeg-devel,v3,6/6] avformat/hlsenc: simplify code to pass s directly

Message ID 1593041559-27350-6-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit 0e10f54585e40a03ea8f19deed50dbf61c8055bc
Headers show
Series [FFmpeg-devel,v3,1/6] avutil/opt: check return value of av_bprint_finalize() | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Lance Wang June 24, 2020, 11:32 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Suggested-by:  Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/hlsenc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Lance Wang June 26, 2020, 2:01 p.m. UTC | #1
On Thu, Jun 25, 2020 at 07:32:39AM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Suggested-by:  Nicolas George <george@nsup.org>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavformat/hlsenc.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index a34da2f..0a318d2 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -365,7 +365,6 @@ fail:
>  static int replace_str_data_in_filename(char **s, const char *filename, char placeholder, const char *datastring)
>  {
>      const char *p;
> -    char *new_filename;
>      char c;
>      int addchar_count;
>      int found_count = 0;
> @@ -398,16 +397,14 @@ static int replace_str_data_in_filename(char **s, const char *filename, char pla
>          av_bprint_finalize(&buf, NULL);
>          return AVERROR(ENOMEM);
>      }
> -    if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0)
> +    if ((ret = av_bprint_finalize(&buf, s)) < 0)
>          return ret;
> -    *s = new_filename;
>      return found_count;
>  }
>  
>  static int replace_int_data_in_filename(char **s, const char *filename, char placeholder, int64_t number)
>  {
>      const char *p;
> -    char *new_filename;
>      char c;
>      int nd, addchar_count;
>      int found_count = 0;
> @@ -448,9 +445,8 @@ static int replace_int_data_in_filename(char **s, const char *filename, char pla
>          av_bprint_finalize(&buf, NULL);
>          return AVERROR(ENOMEM);
>      }
> -    if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0)
> +    if ((ret = av_bprint_finalize(&buf, s)) < 0)
>          return ret;
> -    *s = new_filename;
>      return found_count;
>  }
>  
> -- 
> 1.8.3.1
> 

will apply the patchset tomorrow if no objections.
Nicolas George June 26, 2020, 2:03 p.m. UTC | #2
lance.lmwang@gmail.com (12020-06-26):
> will apply the patchset tomorrow if no objections.

It was posted yesterday!

@subheading Always wait long enough before pushing changes
Do NOT commit to code actively maintained by others without permission.
Send a patch to ffmpeg-devel. If no one answers within a reasonable
time-frame (12h for build failures and security fixes, 3 days small changes,
1 week for big patches) then commit your patch if you think it is OK.
Also note, the maintainer can simply ask for more time to review!

Regards,
Lance Wang June 26, 2020, 2:27 p.m. UTC | #3
On Fri, Jun 26, 2020 at 04:03:58PM +0200, Nicolas George wrote:
> lance.lmwang@gmail.com (12020-06-26):
> > will apply the patchset tomorrow if no objections.
> 
> It was posted yesterday!
> 
> @subheading Always wait long enough before pushing changes
> Do NOT commit to code actively maintained by others without permission.
> Send a patch to ffmpeg-devel. If no one answers within a reasonable
> time-frame (12h for build failures and security fixes, 3 days small changes,
> 1 week for big patches) then commit your patch if you think it is OK.
> Also note, the maintainer can simply ask for more time to review!

No problem, I think most of them are reviewed by you.
it's not urgent, let it pending them.  


> 
> Regards,
> 
> -- 
>   Nicolas George



> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index a34da2f..0a318d2 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -365,7 +365,6 @@  fail:
 static int replace_str_data_in_filename(char **s, const char *filename, char placeholder, const char *datastring)
 {
     const char *p;
-    char *new_filename;
     char c;
     int addchar_count;
     int found_count = 0;
@@ -398,16 +397,14 @@  static int replace_str_data_in_filename(char **s, const char *filename, char pla
         av_bprint_finalize(&buf, NULL);
         return AVERROR(ENOMEM);
     }
-    if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0)
+    if ((ret = av_bprint_finalize(&buf, s)) < 0)
         return ret;
-    *s = new_filename;
     return found_count;
 }
 
 static int replace_int_data_in_filename(char **s, const char *filename, char placeholder, int64_t number)
 {
     const char *p;
-    char *new_filename;
     char c;
     int nd, addchar_count;
     int found_count = 0;
@@ -448,9 +445,8 @@  static int replace_int_data_in_filename(char **s, const char *filename, char pla
         av_bprint_finalize(&buf, NULL);
         return AVERROR(ENOMEM);
     }
-    if ((ret = av_bprint_finalize(&buf, &new_filename)) < 0)
+    if ((ret = av_bprint_finalize(&buf, s)) < 0)
         return ret;
-    *s = new_filename;
     return found_count;
 }