mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
textbtree: Don't opencode realloc
We can just use g_realloc here.
This commit is contained in:
parent
a93614409e
commit
d731ce49ad
@ -6496,21 +6496,9 @@ inc_count (GtkTextTag *tag, int inc, TagInfo *tagInfoPtr)
|
||||
|
||||
if (tagInfoPtr->numTags == tagInfoPtr->arraySize)
|
||||
{
|
||||
GtkTextTag **newTags;
|
||||
int *newCounts, newSize;
|
||||
|
||||
newSize = 2*tagInfoPtr->arraySize;
|
||||
newTags = (GtkTextTag **) g_malloc ((unsigned)
|
||||
(newSize*sizeof (GtkTextTag *)));
|
||||
memcpy ((void *) newTags, (void *) tagInfoPtr->tags,
|
||||
tagInfoPtr->arraySize *sizeof (GtkTextTag *));
|
||||
g_free ((char *) tagInfoPtr->tags);
|
||||
tagInfoPtr->tags = newTags;
|
||||
newCounts = (int *) g_malloc ((unsigned) (newSize*sizeof (int)));
|
||||
memcpy ((void *) newCounts, (void *) tagInfoPtr->counts,
|
||||
tagInfoPtr->arraySize *sizeof (int));
|
||||
g_free ((char *) tagInfoPtr->counts);
|
||||
tagInfoPtr->counts = newCounts;
|
||||
int newSize = 2 * tagInfoPtr->arraySize;
|
||||
tagInfoPtr->tags = g_realloc (tagInfoPtr->tags, newSize * sizeof (GtkTextTag *));
|
||||
tagInfoPtr->counts = g_realloc (tagInfoPtr->counts, newSize * sizeof (int));
|
||||
tagInfoPtr->arraySize = newSize;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user