[MPlayer-dev-eng] [PATCH 6/7] stream ftp: Allocate command buffer on-heap

Alexander Strasser eclipse7 at gmx.net
Wed Nov 14 20:38:42 CET 2012


Hi Diego,

Diego Biurrun wrote:
> On Sun, Nov 11, 2012 at 10:01:41PM +0100, Alexander Strasser wrote:
> > --- a/stream/stream_ftp.c
> > +++ b/stream/stream_ftp.c
> > @@ -51,6 +51,7 @@ static struct stream_priv_s {
> >    int handle;
> >    int cavail,cleft;
> >    char *buf;
> > +  char *cmd_buf;
> >  } stream_priv_dflts = {
> >    "anonymous","no at spam",
> >    NULL,
> > @@ -61,9 +62,12 @@ static struct stream_priv_s {
> >  
> >    0,
> >    0,0,
> > -  NULL
> > +  NULL,
> > +  NULL,
> >  };
> 
> The object you are initializing is static, so every member is implicitly
> initialized to NULL or 0 anyway.  You should rather drop the pointless
> 0/NULL initializations and replace the others by designated initializers
> if you want to clean this up.

  I know but pointless or not it is at least consistent with the current
situation. This patch set's objective is only to help with FTP conversations
that contain e.g. long paths. Making anything but the change I did above
would either hurt the source's readability or generate noise in the patches.

  Changing it to designated initializers could be done in a cleanup patch
set, which I think I will do. The file could clearly use some love; after
all it has been working for its users well for about a decade ;)

  Thank you for the feedback!

  Alexander


More information about the MPlayer-dev-eng mailing list