Author: pepeto
Date: Tue Jan 13 16:40:37 2015
New Revision: 27663

URL: http://svn.gna.org/viewcvs/freeciv?rev=27663&view=rev
Log:
Remove a couple of functionalities made inside fc_assert_XXX() calls.

See gna patch #5700

Modified:
    trunk/client/options.c
    trunk/server/savegame2.c
    trunk/server/savegame3.c
    trunk/utility/support.c

Modified: trunk/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/options.c?rev=27663&r1=27662&r2=27663&view=diff
==============================================================================
--- trunk/client/options.c      (original)
+++ trunk/client/options.c      Tue Jan 13 16:40:37 2015
@@ -5688,12 +5688,20 @@
 static void mapimg_changed_callback(struct option *poption)
 {
   if (!mapimg_client_define()) {
+    bool success;
+
     log_normal("Error setting the value for %s (%s). Restoring the default "
                "value.", option_name(poption), mapimg_error());
 
     /* Reset the value to the default value. */
-    fc_assert_ret(TRUE == option_reset(poption));
-    fc_assert_ret(TRUE == mapimg_client_define());
+    success = option_reset(poption);
+    fc_assert_msg(success == TRUE,
+                  "Failed to reset the option \"%s\".",
+                  option_name(poption));
+    success = mapimg_client_define();
+    fc_assert_msg(success == TRUE,
+                  "Failed to restore mapimg definition for option \"%s\".",
+                  option_name(poption));
   }
 }
 

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=27663&r1=27662&r2=27663&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Tue Jan 13 16:40:37 2015
@@ -3901,7 +3901,9 @@
     fc_assert_action(id_trans == -1 || ptrans != NULL, continue);
 
     if (ptrans) {
-      fc_assert_action(unit_transport_load(punit, ptrans, TRUE), continue);
+      bool load_success = unit_transport_load(punit, ptrans, TRUE);
+
+      fc_assert_action(load_success == TRUE, continue);
     }
   }
 }

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=27663&r1=27662&r2=27663&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Tue Jan 13 16:40:37 2015
@@ -5491,7 +5491,9 @@
     fc_assert_action(id_trans == -1 || ptrans != NULL, continue);
 
     if (ptrans) {
-      fc_assert_action(unit_transport_load(punit, ptrans, TRUE), continue);
+      bool load_success = unit_transport_load(punit, ptrans, TRUE);
+
+      fc_assert_action(load_success == TRUE, continue);
     }
   }
 }

Modified: trunk/utility/support.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/support.c?rev=27663&r1=27662&r2=27663&view=diff
==============================================================================
--- trunk/utility/support.c     (original)
+++ trunk/utility/support.c     Tue Jan 13 16:40:37 2015
@@ -490,6 +490,7 @@
                        const char *replace)
 {
   size_t len_max;
+  bool success;
 
   fc_assert_ret_val(str != NULL, NULL);
   fc_assert_ret_val(len != NULL, NULL);
@@ -505,8 +506,9 @@
     str = fc_realloc(str, len_max);
   }
 
+  success = fc_strrep(str, (*len), search, replace);
   /* should never happen */
-  fc_assert_ret_val_msg(fc_strrep(str, (*len), search, replace), NULL,
+  fc_assert_ret_val_msg(success == TRUE, NULL,
                         "Can't replace '%s' by '%s' in '%s'. To small "
                         "size after reallocation: %lu.", search, replace,
                         str, (long unsigned int)*len);


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

Reply via email to