Author: cazfi
Date: Sun May  7 21:06:20 2017
New Revision: 35447

URL: http://svn.gna.org/viewcvs/freeciv?rev=35447&view=rev
Log:
Add bugs.[ch] module

See hrm Feature #657706

Added:
    trunk/utility/bugs.c
    trunk/utility/bugs.h
Modified:
    trunk/client/agents/cma_core.c
    trunk/client/gui-sdl2/mapview.c
    trunk/server/srv_main.c
    trunk/translations/core/POTFILES.in
    trunk/utility/Makefile.am
    trunk/utility/netintf.c
    trunk/utility/registry_ini.c

Modified: trunk/client/agents/cma_core.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/agents/cma_core.c?rev=35447&r1=35446&r2=35447&view=diff
==============================================================================
--- trunk/client/agents/cma_core.c      (original)
+++ trunk/client/agents/cma_core.c      Sun May  7 21:06:20 2017
@@ -21,6 +21,7 @@
 #endif
 
 /* utility */
+#include "bugs.h"
 #include "fcintl.h"
 #include "log.h"
 #include "mem.h"
@@ -420,10 +421,8 @@
 
     cma_release_city(pcity);
 
-    log_error("handle_city() CMA: %s has changed multiple times.",
-              city_name_get(pcity));
-    /* TRANS: No full stop after the URL, could cause confusion. */
-    log_error(_("Please report this message at %s"), BUG_URL);
+    bugreport_request("handle_city() CMA: %s has changed multiple times.",
+                      city_name_get(pcity));
   }
 
   log_handle_city2("END handle city=(%d)", city_id);

Modified: trunk/client/gui-sdl2/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/mapview.c?rev=35447&r1=35446&r2=35447&view=diff
==============================================================================
--- trunk/client/gui-sdl2/mapview.c     (original)
+++ trunk/client/gui-sdl2/mapview.c     Sun May  7 21:06:20 2017
@@ -32,6 +32,7 @@
 
 /* utility */
 #include "astring.h"
+#include "bugs.h"
 #include "fcintl.h"
 #include "log.h"
 
@@ -164,10 +165,8 @@
       /* We don't want to set is_flush_queued in this case, since then
        * the flush code would simply stop working.  But this means the
        * below message may be repeated many times. */
-      log_error(_("Failed to add events to SDL2 event buffer: %s"),
-                SDL_GetError());
-      /* TRANS: No full stop after the URL, could cause confusion. */
-      log_error(_("Please report this message at %s"), BUG_URL);
+      bugreport_request(_("Failed to add events to SDL2 event buffer: %s"),
+                        SDL_GetError());
     }
   }
 }

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=35447&r1=35446&r2=35447&view=diff
==============================================================================
--- trunk/server/srv_main.c     (original)
+++ trunk/server/srv_main.c     Sun May  7 21:06:20 2017
@@ -45,6 +45,7 @@
 /* utility */
 #include "astring.h"
 #include "bitvector.h"
+#include "bugs.h"
 #include "capability.h"
 #include "fc_cmdline.h"
 #include "fciconv.h"
@@ -2976,9 +2977,8 @@
       }
     }
     if (!created) {
-      log_error(_("Cannot create suitable map with given settings."));
-       /* TRANS: No full stop after the URL, could cause confusion. */
-      log_error(_("Please report this message at %s"), BUG_URL);
+      bugreport_request(_("Cannot create suitable map with given settings."));
+
       exit(EXIT_FAILURE);
     }
 

Modified: trunk/translations/core/POTFILES.in
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/translations/core/POTFILES.in?rev=35447&r1=35446&r2=35447&view=diff
==============================================================================
--- trunk/translations/core/POTFILES.in (original)
+++ trunk/translations/core/POTFILES.in Sun May  7 21:06:20 2017
@@ -392,6 +392,7 @@
 server/unittools.c
 server/voting.c
 utility/astring.c
+utility/bugs.c
 utility/fc_cmdline.c
 utility/fciconv.c
 utility/inputfile.c

Modified: trunk/utility/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/Makefile.am?rev=35447&r1=35446&r2=35447&view=diff
==============================================================================
--- trunk/utility/Makefile.am   (original)
+++ trunk/utility/Makefile.am   Sun May  7 21:06:20 2017
@@ -11,6 +11,8 @@
                astring.h       \
                bitvector.c     \
                bitvector.h     \
+               bugs.c          \
+               bugs.h          \
                capability.c    \
                capability.h    \
                deprecations.c  \

Added: trunk/utility/bugs.c
URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/bugs.c?rev=35447&view=auto
==============================================================================
--- trunk/utility/bugs.c        (added)
+++ trunk/utility/bugs.c        Sun May  7 21:06:20 2017
@@ -0,0 +1,43 @@
+/***********************************************************************
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <fc_config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include "fc_prehdrs.h"
+
+#include <stdarg.h>
+
+/* utility */
+#include "fcintl.h"
+#include "log.h"
+
+#include "bugs.h"
+
+/************************************************************************
+  Print request for bugreport
+************************************************************************/
+void bugreport_request(const char *reason_format, ...)
+{
+  va_list args;
+  char buf[1024];
+
+  va_start(args, reason_format);
+  vdo_log(__FILE__, __FUNCTION__, __FC_LINE__, FALSE, LOG_ERROR,
+          buf, sizeof(buf), reason_format, args);
+  va_end(args);
+
+  /* TRANS: No full stop after the URL, could cause confusion. */
+  log_error(_("Please report this message at %s"), BUG_URL);
+}

Added: trunk/utility/bugs.h
URL: http://svn.gna.org/viewcvs/freeciv/trunk/utility/bugs.h?rev=35447&view=auto
==============================================================================
--- trunk/utility/bugs.h        (added)
+++ trunk/utility/bugs.h        Sun May  7 21:06:20 2017
@@ -0,0 +1,27 @@
+/***********************************************************************
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***********************************************************************/
+
+#ifndef FC__BUGS_H
+#define FC__BUGS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+void bugreport_request(const char *reason_format, ...);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* FC__BUGS_H */

Modified: trunk/utility/netintf.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/netintf.c?rev=35447&r1=35446&r2=35447&view=diff
==============================================================================
--- trunk/utility/netintf.c     (original)
+++ trunk/utility/netintf.c     Sun May  7 21:06:20 2017
@@ -50,6 +50,7 @@
 #endif
 
 /* utility */
+#include "bugs.h"
 #include "fcintl.h"
 #include "log.h"
 #include "mem.h"
@@ -88,10 +89,8 @@
       errno = err;
       return;
     default:
-      log_error("Missing errno mapping for Winsock error #%d.", err);
-      /* TRANS: No full stop after the URL, could cause confusion. */
-      log_error(_("Please report this message at %s"), BUG_URL);
-
+      bugreport_request("Missing errno mapping for Winsock error #%d.", err);
+ 
       errno = 0;
   }
 }

Modified: trunk/utility/registry_ini.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/registry_ini.c?rev=35447&r1=35446&r2=35447&view=diff
==============================================================================
--- trunk/utility/registry_ini.c        (original)
+++ trunk/utility/registry_ini.c        Sun May  7 21:06:20 2017
@@ -158,6 +158,7 @@
 
 /* utility */
 #include "astring.h"
+#include "bugs.h"
 #include "deprecations.h"
 #include "fcintl.h"
 #include "inputfile.h"
@@ -775,14 +776,12 @@
                  * FIXME: If the first row is missing some entries that the
                  * second or later row has, then we'll drop out of tabular
                  * format without an error message. */
-                log_error("In file %s, there is no entry in the registry for\n"
-                          "%s.%s (or the entries are out of order). This 
means\n"
-                          "a less efficient non-tabular format will be used.\n"
-                          "To avoid this make sure all rows of a table are\n"
-                          "filled out with an entry for every column.",
-                          real_filename, section_name(psection), expect);
-                /* TRANS: No full stop after the URL, could cause confusion. */
-                log_error(_("Please report this message at %s"), BUG_URL);
+                bugreport_request("In file %s, there is no entry in the 
registry for\n"
+                                  "%s.%s (or the entries are out of order). 
This means\n"
+                                  "a less efficient non-tabular format will be 
used.\n"
+                                  "To avoid this make sure all rows of a table 
are\n"
+                                  "filled out with an entry for every column.",
+                                  real_filename, section_name(psection), 
expect);
                 fz_fprintf(fs, "\n");
               }
               fz_fprintf(fs, "}\n");


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

Reply via email to