Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#8500) packet_single_want_hack_req isn't freed
Home

[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]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8500) packet_single_want_hack_req isn't freed
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Apr 2004 08:46:55 -0700
Reply-to: rt@xxxxxxxxxxx

<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




[Prev in Thread] Current Thread [Next in Thread]