Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2006:
[Freeciv-Dev] (PR#16471) Fix use of wrong functions
Home

[Freeciv-Dev] (PR#16471) Fix use of wrong functions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#16471) Fix use of wrong functions
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 16 Apr 2006 08:55:31 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16471 >

Use of snprintf, vsnprintf and malloc converted to permitted freeciv
variants. Nitpicky, I know.

  - Per

Index: server/savegame.c
===================================================================
--- server/savegame.c   (revision 11855)
+++ server/savegame.c   (working copy)
@@ -1055,7 +1055,7 @@
         if (ptile->owner == NULL) {
           strcpy(token, "-");
         } else {
-          snprintf(token, sizeof(token), "%d", ptile->owner->player_no);
+          my_snprintf(token, sizeof(token), "%d", ptile->owner->player_no);
         }
         strcat(line, token);
         if (x + 1 < map.xsize) {
@@ -1075,7 +1075,7 @@
         if (ptile->owner_source == NULL) {
           strcpy(token, "-");
         } else {
-          snprintf(token, sizeof(token), "%d", ptile->owner_source->index);
+          my_snprintf(token, sizeof(token), "%d", ptile->owner_source->index);
         }
         strcat(line, token);
         if (x + 1 < map.xsize) {
Index: common/worklist.c
===================================================================
--- common/worklist.c   (revision 11855)
+++ common/worklist.c   (working copy)
@@ -221,7 +221,7 @@
   /* The first part of the registry path is taken from the varargs to the
    * function. */
   va_start(ap, path);
-  vsnprintf(path_str, sizeof(path_str), path, ap);
+  my_vsnprintf(path_str, sizeof(path_str), path, ap);
   va_end(ap);
 
   init_worklist(pwl);
@@ -280,7 +280,7 @@
   /* The first part of the registry path is taken from the varargs to the
    * function. */
   va_start(ap, path);
-  vsnprintf(path_str, sizeof(path_str), path, ap);
+  my_vsnprintf(path_str, sizeof(path_str), path, ap);
   va_end(ap);
 
   secfile_insert_int(file, pwl->length, "%s.wl_length", path_str);
Index: client/packhand.c
===================================================================
--- client/packhand.c   (revision 11855)
+++ client/packhand.c   (working copy)
@@ -2486,7 +2486,7 @@
   }
 
   pl->num_groups = p->ngroups;
-  pl->groups = malloc(sizeof(*(pl->groups)) * pl->num_groups);
+  pl->groups = fc_malloc(sizeof(*(pl->groups)) * pl->num_groups);
   for (i = 0; i < p->ngroups; i++) {
     pl->groups[i] = get_nation_group_by_id(p->groups[i]);
     if (!pl->groups[i]) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#16471) Fix use of wrong functions, Per I. Mathisen <=