Author: cazfi
Date: Wed Nov 11 20:23:05 2015
New Revision: 30550

URL: http://svn.gna.org/viewcvs/freeciv?rev=30550&view=rev
Log:
Send packet-like structures without extra copy-operation.

See patch #6556

Modified:
    trunk/server/gamehand.c
    trunk/server/ruleset.c

Modified: trunk/server/gamehand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/gamehand.c?rev=30550&r1=30549&r2=30550&view=diff
==============================================================================
--- trunk/server/gamehand.c     (original)
+++ trunk/server/gamehand.c     Wed Nov 11 20:23:05 2015
@@ -861,14 +861,12 @@
 **************************************************************************/
 void send_game_info(struct conn_list *dest)
 {
-  struct packet_game_info ginfo;
   struct packet_timeout_info tinfo;
 
   if (!dest) {
     dest = game.est_connections;
   }
 
-  ginfo = game.info;
   tinfo = game.tinfo;
 
   /* the following values are computed every
@@ -891,7 +889,7 @@
   conn_list_iterate(dest, pconn) {
     /* These are separate packets as first one may not get sent at all
      * if there's no changes in it */
-    send_packet_game_info(pconn, &ginfo);
+    send_packet_game_info(pconn, &(game.info));
     send_packet_timeout_info(pconn, &tinfo);
   }
   conn_list_iterate_end;
@@ -902,16 +900,12 @@
 **************************************************************************/
 void send_scenario_info(struct conn_list *dest)
 {
-  struct packet_scenario_info sinfo;
-
   if (!dest) {
     dest = game.est_connections;
   }
 
-  sinfo = game.scenario;
-
   conn_list_iterate(dest, pconn) {
-    send_packet_scenario_info(pconn, &sinfo);
+    send_packet_scenario_info(pconn, &(game.scenario));
   } conn_list_iterate_end;
 }
 

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=30550&r1=30549&r2=30550&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Wed Nov 11 20:23:05 2015
@@ -3499,12 +3499,10 @@
 **************************************************************************/
 static void send_ruleset_control(struct conn_list *dest)
 {
-  struct packet_ruleset_control packet;
   int desc_left = game.control.desc_length;
   int index = 0;
 
-  packet = game.control;
-  lsend_packet_ruleset_control(dest, &packet);
+  lsend_packet_ruleset_control(dest, &(game.control));
 
   if (game.ruleset_summary != NULL) {
     struct packet_ruleset_summary summary;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to