Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7418) memory usage for compiling
Home

[Freeciv-Dev] Re: (PR#7418) memory usage for compiling

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ue80@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7418) memory usage for compiling
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 15 Feb 2004 17:44:28 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7418 >

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7418 >
> 
>>[i-freeciv-lists@xxxxxxxxxxxxx - Fri Feb 13 10:31:07 2004]:
> 
> 
>>>The former should be quite possible; it requires changes to
>>
>>generate.py.
>>
>>>  You'll have to take it up with Raimar.
>>
>>What idea(s) do you have?
> 
> None.  But based on the changes I see in each diff I'd say there is a
> lot of redundancy.

There are a switch statements that are unnecessary.  With a single array 
definition these switches can be replaced by a single array lookup.  For 
instance

   void *get_packet_from_connection_helper(pc, type)
   {
     return (packet_data[type].helper)(pc, type);
   }

   void *get_packet_name(type)
   {
     return packet_data[type].name;
   }


Then we have code like:

   switch(pc->phs.variant[PACKET_CITY_NAME_SUGGESTION_INFO]) {
     case 100: return send_packet_city_name_suggestion_info_100(pc,
                                                        packet);
     default: die("unknown variant"); return -1;
   }

do we really want to die here?  Does this mean the client can kill the 
server?  Why is a switch even needed?


Question: why do packets have different variants?  100 versus 101?  How 
come they have to have entirely different functions to handle them?

jason




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