[FFmpeg-devel] [PATCH] lavf/segment: consistently use "seg" in segment_start()

Alexander Strasser eclipse7 at gmx.net
Sat Nov 17 18:12:56 CET 2012


Hi Stefano,

Stefano Sabatini wrote:
> ---
>  libavformat/segment.c |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index f31b25f..75dbd35 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -119,27 +119,27 @@ static int segment_mux_init(AVFormatContext *s)
>  
>  static int segment_start(AVFormatContext *s, int write_header)
>  {
> -    SegmentContext *c = s->priv_data;
> -    AVFormatContext *oc = c->avf;
> +    SegmentContext *seg = s->priv_data;
> +    AVFormatContext *oc = seg->avf;
>      int err = 0;
>  
>      if (write_header) {
>          avformat_free_context(oc);
> -        c->avf = NULL;
> +        seg->avf = NULL;

  I am not against your patch but I wanted to take the occasion to
state my opinion on this habit.

  IMHO it should not be done, just name it ctx everywhere. Naming
it something dependent on the class/ADT the routines are written
for does only do harm. The variation hurts readability more than
it helps and it makes c&p more involved even where it is useful.

  Of course the above paragraph is not directed at Stefano personally.

  Sorry for the rant...

[...]

  Alexander


More information about the ffmpeg-devel mailing list