[FFmpeg-cvslog] r13905 - trunk/ffserver.c

Måns Rullgård mans
Mon Jun 23 12:26:14 CEST 2008


Baptiste Coudurier wrote:
> M?ns Rullg?rd wrote:
>> bcoudurier <subversion at mplayerhq.hu> writes:
>>
>>> Author: bcoudurier
>>> Date: Mon Jun 23 05:21:40 2008
>>> New Revision: 13905
>>>
>>> Log:
>>> fix compilation, this should be better
>>>
>>> Modified:
>>>    trunk/ffserver.c
>>>
>>> Modified: trunk/ffserver.c
>>> ==============================================================================
>>> --- trunk/ffserver.c	(original)
>>> +++ trunk/ffserver.c	Mon Jun 23 05:21:40 2008
>>> @@ -2158,10 +2158,11 @@ static int http_prepare_data(HTTPContext
>>>                          }
>>>                      }
>>>                  } else {
>>> -                send_it:
>>>                      AVCodecContext *codec;
>>> -                    AVStream *ist = c->fmt_in->streams[source_index];
>>> -                    AVStream *ost = ctx->streams[pkt.stream_index];
>>> +                    AVStream *ist, *ost;
>>> +                send_it:
>>> +                    ist = c->fmt_in->streams[source_index];
>>> +                    ost = ctx->streams[pkt.stream_index];
>>>                      /* specific handling for RTP: we use several
>>>                         output stream (one for each RTP
>>>                         connection). XXX: need more abstract handling */
>>
>> This is invalid.  If you jump in after a declaration, there is no
>> guarantee that the (stack) space has been allocated.  You have to move
>> those declarations out to a block containing both the goto statement
>> and the label.
>>
>
> Yes I figured that out pretty quickly. I learnt something today, besides
> that what you get by hearing that "never use goto" policy, when you
> finally learn when to use it, you miss all the concepts :/

With goto, a good rule of thumb is to never jump into a block.  If you
follow this rule, you'll rarely run into trouble of this kind.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-cvslog mailing list