From: Holger Schemel Date: Fri, 23 Feb 2024 15:03:10 +0000 (+0100) Subject: replaced glib function calls to g_memdup() X-Git-Tag: 4.4.0.0-test-1~308 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ade923d10dfedc818718fbdc144db6dfc63a1681;p=rocksndiamonds.git replaced glib function calls to g_memdup() --- diff --git a/src/game_bd/bd_bdcff.c b/src/game_bd/bd_bdcff.c index 9d2a509c..663d9778 100644 --- a/src/game_bd/bd_bdcff.c +++ b/src/game_bd/bd_bdcff.c @@ -1194,12 +1194,12 @@ boolean gd_caveset_load_from_bdcff(const char *contents) object.element = cave->initial_border; object.fill_element = cave->initial_border; - cave->objects = g_list_prepend(cave->objects, g_memdup(&object, sizeof(object))); + cave->objects = g_list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); object.x1 = 19; object.y1 = 0; /* 19, as it is also the border */ - cave->objects = g_list_prepend(cave->objects, g_memdup(&object, sizeof(object))); /* another */ + cave->objects = g_list_prepend(cave->objects, getMemCopy(&object, sizeof(object))); /* another */ } } } diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 15dc6cf1..197bec5e 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -506,7 +506,7 @@ gpointer gd_cave_map_dup_size(const GdCave *cave, const gpointer map, const int return NULL; rows = checked_malloc((cave->h) * sizeof(gpointer)); - rows[0] = g_memdup (maplines[0], cell_size * cave->w * cave->h); + rows[0] = getMemCopy (maplines[0], cell_size * cave->w * cave->h); for (y = 1; y < cave->h; y++) rows[y] = (char *)rows[0] + cell_size * cave->w * y; @@ -605,7 +605,7 @@ void gd_cave_copy(GdCave *dest, const GdCave *src) dest->objects = NULL; /* new empty list */ for (iter = src->objects; iter != NULL; iter = iter->next) /* do a deep copy */ - dest->objects = g_list_append(dest->objects, g_memdup (iter->data, sizeof (GdObject))); + dest->objects = g_list_append(dest->objects, getMemCopy (iter->data, sizeof (GdObject))); } /* copy replays */ @@ -1400,7 +1400,7 @@ GdReplay *gd_replay_new_from_replay(GdReplay *orig) { GdReplay *rep; - rep = g_memdup(orig, sizeof(GdReplay)); + rep = getMemCopy(orig, sizeof(GdReplay)); /* replicate dynamic data */ rep->comment = getStringCopy(orig->comment); diff --git a/src/game_bd/bd_caveobject.c b/src/game_bd/bd_caveobject.c index 1cfaca20..054235a9 100644 --- a/src/game_bd/bd_caveobject.c +++ b/src/game_bd/bd_caveobject.c @@ -313,7 +313,7 @@ GdObject *gd_object_new_from_string(char *str) { object.element = gd_get_element_from_string(elem0); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -327,7 +327,7 @@ GdObject *gd_object_new_from_string(char *str) { object.element = gd_get_element_from_string(elem0); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -341,7 +341,7 @@ GdObject *gd_object_new_from_string(char *str) object.type = GD_RECTANGLE; object.element = gd_get_element_from_string (elem0); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -360,14 +360,14 @@ GdObject *gd_object_new_from_string(char *str) object.element = gd_get_element_from_string (elem0); object.fill_element = gd_get_element_from_string (elem1); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } if (paramcount == 5) { object.element = object.fill_element = gd_get_element_from_string (elem0); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -387,7 +387,7 @@ GdObject *gd_object_new_from_string(char *str) object.type = GD_RASTER; object.element = gd_get_element_from_string (elem0); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -403,7 +403,7 @@ GdObject *gd_object_new_from_string(char *str) object.element = gd_get_element_from_string (elem0); object.fill_element = gd_get_element_from_string (elem1); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -418,7 +418,7 @@ GdObject *gd_object_new_from_string(char *str) object.fill_element = gd_get_element_from_string (elem0); object.element = gd_get_element_from_string (elem1); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -433,7 +433,7 @@ GdObject *gd_object_new_from_string(char *str) object.fill_element = gd_get_element_from_string (elem0); object.element = gd_get_element_from_string (elem1); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -463,7 +463,7 @@ GdObject *gd_object_new_from_string(char *str) object.element = gd_get_element_from_string (elem0); object.fill_element = gd_get_element_from_string (elem1); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } return NULL; @@ -519,7 +519,7 @@ GdObject *gd_object_new_from_string(char *str) if (l > 10 && l % 2 == 1) object.element = gd_get_element_from_string(words[l - 1]); - return g_memdup(&object, sizeof (GdObject)); + return getMemCopy(&object, sizeof (GdObject)); } /* COPY PASTE OBJECT */ @@ -550,7 +550,7 @@ GdObject *gd_object_new_from_string(char *str) else Warn("invalid setting for copypaste flip property: %s", flip); - return g_memdup(&object, sizeof(GdObject)); + return getMemCopy(&object, sizeof(GdObject)); } return NULL;