[MPlayer-dev-eng] [PATCH] Fix socket address initialization

kmkaplan+mplayer-dev-eng at kim.kim-minh.com kmkaplan+mplayer-dev-eng at kim.kim-minh.com
Wed Feb 25 13:34:02 CET 2009


Reimar Döffinger:

> On Wed, Feb 25, 2009 at 10:23:24AM +0000, kmkaplan+mplayer-dev-eng at kim.kim-minh.com wrote:
>>    server_address.sin_family = AF_INET;
>>    server_address.sin_port = htons (url->port);
>> +  memset(server_address.sin_zero, 0, sizeof server_address.sin_zero);
>
> This should instead clear all of server_address, before setting any
> fields. This probably could be done during declaration by add "= {0}",
> but that might be considered ugly.

You can do it that way if you prefer, it's just that clearing fields
that will be overwrittent seems like a waste, but obviousy it would work
as well.

> Also in MPlayer code we usually use sizeof with () like a function.

Ditto, change as you whish it is exactly the same.

Kim Minh.




More information about the MPlayer-dev-eng mailing list