mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
ghash: Use g_memdup2() instead of g_memdup()
Backport of part of commit 0736b7c1e7cf4232c5d7eb2b0fbfe9be81bd3baa to the simpler structure of the GHashTable code in glib-2-58. Helps: #2319 Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
64bcc1176e
commit
324a29c6e8
@ -34,6 +34,7 @@
|
||||
|
||||
#include "glib-private.h"
|
||||
#include "gstrfuncs.h"
|
||||
#include "gstrfuncsprivate.h"
|
||||
#include "gatomic.h"
|
||||
#include "gtestutils.h"
|
||||
#include "gslice.h"
|
||||
@ -967,7 +968,7 @@ g_hash_table_insert_node (GHashTable *hash_table,
|
||||
* split the table.
|
||||
*/
|
||||
if (G_UNLIKELY (hash_table->keys == hash_table->values && hash_table->keys[node_index] != new_value))
|
||||
hash_table->values = g_memdup (hash_table->keys, sizeof (gpointer) * hash_table->size);
|
||||
hash_table->values = g_memdup2 (hash_table->keys, sizeof (gpointer) * hash_table->size);
|
||||
|
||||
/* Step 3: Actually do the write */
|
||||
hash_table->values[node_index] = new_value;
|
||||
|
Loading…
x
Reference in New Issue
Block a user