[Freeciv-Dev] Re: (PR#8500) packet_single_want_hack_req isn't freed
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8500 >
Raimar Falke wrote:
> On Mon, Apr 12, 2004 at 04:43:44PM -0700, Jason Short wrote:
>>>And do the same thing to the client.
>> if (read_from_connection(&aconnection, FALSE) >= 0) {
>> enum packet_type type;
>
>
>> bool result;
>
>
> Why not also move this?
Err, sure.
>>- void *packet;
>>
>> while (TRUE) {
>>- packet = get_packet_from_connection(&aconnection, &type, &result);
>>- if (result) {
>>+ void *packet = get_packet_from_connection(&aconnection,
>>+ &type, &result);
>>+
>
>
>>+ if (result && packet) {
>
>
> Can we change this to
>
>>+ if (result) {
>>+ assert(packet);
If result => packet then we don't need result. We should change
get_packet_from_connection to remove this value.
I'm not entirely convinced that result => packet.
get_packet_from_connection has many subfunctions. But we don't really
care what value result gives us, all we care about is if there's a packet.
packet => result is certainly true, however. It is easy to verify that
!result => !packet.
jason
|
|