mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
use standard_calloc to allocate the profile_data. (#335209, Chris Wilson)
2006-03-20 Matthias Clasen <mclasen@redhat.com> * glib/gmem.c (profiler_log): use standard_calloc to allocate the profile_data. (#335209, Chris Wilson) * glib/gmain.c (g_main_context_unref): Avoid a deadlock. (#335207, Chris Wilson) Minor optimizations (#335216, Chris Wilson): * glib/gasyncqueue.c (g_async_queue_pop_intern_unlocked): Use g_queue_peek_tail_link instead of g_queue_peek_tail. * glib/glist.c: * glib/gslist.c: Avoid some memset calls.
This commit is contained in:
parent
56b06e14dc
commit
d0ee63840c
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
||||
2006-03-20 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gmem.c (profiler_log): use standard_calloc to allocate
|
||||
the profile_data. (#335209, Chris Wilson)
|
||||
|
||||
* glib/gmain.c (g_main_context_unref): Avoid a deadlock.
|
||||
(#335207, Chris Wilson)
|
||||
|
||||
Minor optimizations (#335216, Chris Wilson):
|
||||
|
||||
* glib/gasyncqueue.c (g_async_queue_pop_intern_unlocked): Use
|
||||
g_queue_peek_tail_link instead of g_queue_peek_tail.
|
||||
|
||||
* glib/glist.c:
|
||||
* glib/gslist.c: Avoid some memset calls.
|
||||
|
||||
2006-03-19 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* MAINTAINERS: Add this, at the request of the GNOME sysadmin team.
|
||||
|
@ -1,3 +1,19 @@
|
||||
2006-03-20 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gmem.c (profiler_log): use standard_calloc to allocate
|
||||
the profile_data. (#335209, Chris Wilson)
|
||||
|
||||
* glib/gmain.c (g_main_context_unref): Avoid a deadlock.
|
||||
(#335207, Chris Wilson)
|
||||
|
||||
Minor optimizations (#335216, Chris Wilson):
|
||||
|
||||
* glib/gasyncqueue.c (g_async_queue_pop_intern_unlocked): Use
|
||||
g_queue_peek_tail_link instead of g_queue_peek_tail.
|
||||
|
||||
* glib/glist.c:
|
||||
* glib/gslist.c: Avoid some memset calls.
|
||||
|
||||
2006-03-19 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* MAINTAINERS: Add this, at the request of the GNOME sysadmin team.
|
||||
|
@ -1,3 +1,19 @@
|
||||
2006-03-20 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gmem.c (profiler_log): use standard_calloc to allocate
|
||||
the profile_data. (#335209, Chris Wilson)
|
||||
|
||||
* glib/gmain.c (g_main_context_unref): Avoid a deadlock.
|
||||
(#335207, Chris Wilson)
|
||||
|
||||
Minor optimizations (#335216, Chris Wilson):
|
||||
|
||||
* glib/gasyncqueue.c (g_async_queue_pop_intern_unlocked): Use
|
||||
g_queue_peek_tail_link instead of g_queue_peek_tail.
|
||||
|
||||
* glib/glist.c:
|
||||
* glib/gslist.c: Avoid some memset calls.
|
||||
|
||||
2006-03-19 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* MAINTAINERS: Add this, at the request of the GNOME sysadmin team.
|
||||
|
@ -313,12 +313,13 @@ g_async_queue_push_sorted_unlocked (GAsyncQueue *queue,
|
||||
}
|
||||
|
||||
static gpointer
|
||||
g_async_queue_pop_intern_unlocked (GAsyncQueue* queue, gboolean try,
|
||||
GTimeVal *end_time)
|
||||
g_async_queue_pop_intern_unlocked (GAsyncQueue *queue,
|
||||
gboolean try,
|
||||
GTimeVal *end_time)
|
||||
{
|
||||
gpointer retval;
|
||||
|
||||
if (!g_queue_peek_tail (queue->queue))
|
||||
if (!g_queue_peek_tail_link (queue->queue))
|
||||
{
|
||||
if (try)
|
||||
return NULL;
|
||||
@ -329,18 +330,18 @@ g_async_queue_pop_intern_unlocked (GAsyncQueue* queue, gboolean try,
|
||||
if (!end_time)
|
||||
{
|
||||
queue->waiting_threads++;
|
||||
while (!g_queue_peek_tail (queue->queue))
|
||||
g_cond_wait(queue->cond, queue->mutex);
|
||||
while (!g_queue_peek_tail_link (queue->queue))
|
||||
g_cond_wait (queue->cond, queue->mutex);
|
||||
queue->waiting_threads--;
|
||||
}
|
||||
else
|
||||
{
|
||||
queue->waiting_threads++;
|
||||
while (!g_queue_peek_tail (queue->queue))
|
||||
while (!g_queue_peek_tail_link (queue->queue))
|
||||
if (!g_cond_timed_wait (queue->cond, queue->mutex, end_time))
|
||||
break;
|
||||
queue->waiting_threads--;
|
||||
if (!g_queue_peek_tail (queue->queue))
|
||||
if (!g_queue_peek_tail_link (queue->queue))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
51
glib/glist.c
51
glib/glist.c
@ -37,6 +37,7 @@
|
||||
void g_list_push_allocator (gpointer dummy) { /* present for binary compat only */ }
|
||||
void g_list_pop_allocator (void) { /* present for binary compat only */ }
|
||||
|
||||
#define _g_list_alloc() g_slice_new (GList)
|
||||
#define _g_list_alloc0() g_slice_new0 (GList)
|
||||
#define _g_list_free1(list) g_slice_free (GList, list)
|
||||
|
||||
@ -65,8 +66,9 @@ g_list_append (GList *list,
|
||||
GList *new_list;
|
||||
GList *last;
|
||||
|
||||
new_list = _g_list_alloc0 ();
|
||||
new_list = _g_list_alloc ();
|
||||
new_list->data = data;
|
||||
new_list->next = NULL;
|
||||
|
||||
if (list)
|
||||
{
|
||||
@ -78,7 +80,10 @@ g_list_append (GList *list,
|
||||
return list;
|
||||
}
|
||||
else
|
||||
return new_list;
|
||||
{
|
||||
new_list->prev = NULL;
|
||||
return new_list;
|
||||
}
|
||||
}
|
||||
|
||||
GList*
|
||||
@ -87,19 +92,19 @@ g_list_prepend (GList *list,
|
||||
{
|
||||
GList *new_list;
|
||||
|
||||
new_list = _g_list_alloc0 ();
|
||||
new_list = _g_list_alloc ();
|
||||
new_list->data = data;
|
||||
new_list->next = list;
|
||||
|
||||
if (list)
|
||||
{
|
||||
new_list->prev = list->prev;
|
||||
if (list->prev)
|
||||
{
|
||||
list->prev->next = new_list;
|
||||
new_list->prev = list->prev;
|
||||
}
|
||||
list->prev->next = new_list;
|
||||
list->prev = new_list;
|
||||
new_list->next = list;
|
||||
}
|
||||
else
|
||||
new_list->prev = NULL;
|
||||
|
||||
return new_list;
|
||||
}
|
||||
@ -121,14 +126,11 @@ g_list_insert (GList *list,
|
||||
if (!tmp_list)
|
||||
return g_list_append (list, data);
|
||||
|
||||
new_list = _g_list_alloc0 ();
|
||||
new_list = _g_list_alloc ();
|
||||
new_list->data = data;
|
||||
|
||||
new_list->prev = tmp_list->prev;
|
||||
if (tmp_list->prev)
|
||||
{
|
||||
tmp_list->prev->next = new_list;
|
||||
new_list->prev = tmp_list->prev;
|
||||
}
|
||||
tmp_list->prev->next = new_list;
|
||||
new_list->next = tmp_list;
|
||||
tmp_list->prev = new_list;
|
||||
|
||||
@ -154,20 +156,18 @@ g_list_insert_before (GList *list,
|
||||
{
|
||||
GList *node;
|
||||
|
||||
node = g_list_alloc ();
|
||||
node = _g_list_alloc ();
|
||||
node->data = data;
|
||||
if (sibling->prev)
|
||||
node->prev = sibling->prev;
|
||||
node->next = sibling;
|
||||
sibling->prev = node;
|
||||
if (node->prev)
|
||||
{
|
||||
node->prev = sibling->prev;
|
||||
node->prev->next = node;
|
||||
node->next = sibling;
|
||||
sibling->prev = node;
|
||||
return list;
|
||||
}
|
||||
else
|
||||
{
|
||||
node->next = sibling;
|
||||
sibling->prev = node;
|
||||
g_return_val_if_fail (sibling == list, node);
|
||||
return node;
|
||||
}
|
||||
@ -180,9 +180,10 @@ g_list_insert_before (GList *list,
|
||||
while (last->next)
|
||||
last = last->next;
|
||||
|
||||
last->next = g_list_alloc ();
|
||||
last->next = _g_list_alloc ();
|
||||
last->next->data = data;
|
||||
last->next->prev = last;
|
||||
last->next->next = NULL;
|
||||
|
||||
return list;
|
||||
}
|
||||
@ -310,18 +311,20 @@ g_list_copy (GList *list)
|
||||
{
|
||||
GList *last;
|
||||
|
||||
new_list = _g_list_alloc0 ();
|
||||
new_list = _g_list_alloc ();
|
||||
new_list->data = list->data;
|
||||
new_list->prev = NULL;
|
||||
last = new_list;
|
||||
list = list->next;
|
||||
while (list)
|
||||
{
|
||||
last->next = _g_list_alloc0 ();
|
||||
last->next = _g_list_alloc ();
|
||||
last->next->prev = last;
|
||||
last = last->next;
|
||||
last->data = list->data;
|
||||
list = list->next;
|
||||
}
|
||||
last->next = NULL;
|
||||
}
|
||||
|
||||
return new_list;
|
||||
|
@ -627,7 +627,7 @@ g_main_context_unref (GMainContext *context)
|
||||
while (source)
|
||||
{
|
||||
GSource *next = source->next;
|
||||
g_source_destroy_internal (source, context, TRUE);
|
||||
g_source_destroy_internal (source, context, FALSE);
|
||||
source = next;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ profiler_log (ProfilerJob job,
|
||||
g_mutex_lock (gmem_profile_mutex);
|
||||
if (!profile_data)
|
||||
{
|
||||
profile_data = standard_malloc ((MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0]));
|
||||
profile_data = standard_calloc ((MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0]));
|
||||
if (!profile_data) /* memory system kiddin' me, eh? */
|
||||
{
|
||||
g_mutex_unlock (gmem_profile_mutex);
|
||||
|
@ -38,6 +38,7 @@ void g_slist_push_allocator (gpointer dummy) { /* present for binary compat only
|
||||
void g_slist_pop_allocator (void) { /* present for binary compat only */ }
|
||||
|
||||
#define _g_slist_alloc0() g_slice_new0 (GSList)
|
||||
#define _g_slist_alloc() g_slice_new (GSList)
|
||||
#define _g_slist_free1(slist) g_slice_free (GSList, slist)
|
||||
|
||||
GSList*
|
||||
@ -65,8 +66,9 @@ g_slist_append (GSList *list,
|
||||
GSList *new_list;
|
||||
GSList *last;
|
||||
|
||||
new_list = _g_slist_alloc0 ();
|
||||
new_list = _g_slist_alloc ();
|
||||
new_list->data = data;
|
||||
new_list->next = NULL;
|
||||
|
||||
if (list)
|
||||
{
|
||||
@ -77,7 +79,7 @@ g_slist_append (GSList *list,
|
||||
return list;
|
||||
}
|
||||
else
|
||||
return new_list;
|
||||
return new_list;
|
||||
}
|
||||
|
||||
GSList*
|
||||
@ -86,7 +88,7 @@ g_slist_prepend (GSList *list,
|
||||
{
|
||||
GSList *new_list;
|
||||
|
||||
new_list = _g_slist_alloc0 ();
|
||||
new_list = _g_slist_alloc ();
|
||||
new_list->data = data;
|
||||
new_list->next = list;
|
||||
|
||||
@ -107,11 +109,14 @@ g_slist_insert (GSList *list,
|
||||
else if (position == 0)
|
||||
return g_slist_prepend (list, data);
|
||||
|
||||
new_list = _g_slist_alloc0 ();
|
||||
new_list = _g_slist_alloc ();
|
||||
new_list->data = data;
|
||||
|
||||
if (!list)
|
||||
return new_list;
|
||||
{
|
||||
new_list->next = NULL;
|
||||
return new_list;
|
||||
}
|
||||
|
||||
prev_list = NULL;
|
||||
tmp_list = list;
|
||||
@ -143,8 +148,9 @@ g_slist_insert_before (GSList *slist,
|
||||
{
|
||||
if (!slist)
|
||||
{
|
||||
slist = g_slist_alloc ();
|
||||
slist = _g_slist_alloc ();
|
||||
slist->data = data;
|
||||
slist->next = NULL;
|
||||
g_return_val_if_fail (sibling == NULL, slist);
|
||||
return slist;
|
||||
}
|
||||
@ -157,7 +163,7 @@ g_slist_insert_before (GSList *slist,
|
||||
break;
|
||||
if (!last)
|
||||
{
|
||||
node = g_slist_alloc ();
|
||||
node = _g_slist_alloc ();
|
||||
node->data = data;
|
||||
node->next = slist;
|
||||
|
||||
@ -165,7 +171,7 @@ g_slist_insert_before (GSList *slist,
|
||||
}
|
||||
else
|
||||
{
|
||||
node = g_slist_alloc ();
|
||||
node = _g_slist_alloc ();
|
||||
node->data = data;
|
||||
node->next = last->next;
|
||||
last->next = node;
|
||||
@ -302,17 +308,18 @@ g_slist_copy (GSList *list)
|
||||
{
|
||||
GSList *last;
|
||||
|
||||
new_list = _g_slist_alloc0 ();
|
||||
new_list = _g_slist_alloc ();
|
||||
new_list->data = list->data;
|
||||
last = new_list;
|
||||
list = list->next;
|
||||
while (list)
|
||||
{
|
||||
last->next = _g_slist_alloc0 ();
|
||||
last->next = _g_slist_alloc ();
|
||||
last = last->next;
|
||||
last->data = list->data;
|
||||
list = list->next;
|
||||
}
|
||||
last->next = NULL;
|
||||
}
|
||||
|
||||
return new_list;
|
||||
@ -478,8 +485,9 @@ g_slist_insert_sorted_real (GSList *list,
|
||||
|
||||
if (!list)
|
||||
{
|
||||
new_list = _g_slist_alloc0 ();
|
||||
new_list = _g_slist_alloc ();
|
||||
new_list->data = data;
|
||||
new_list->next = NULL;
|
||||
return new_list;
|
||||
}
|
||||
|
||||
@ -493,12 +501,13 @@ g_slist_insert_sorted_real (GSList *list,
|
||||
cmp = ((GCompareDataFunc) func) (data, tmp_list->data, user_data);
|
||||
}
|
||||
|
||||
new_list = _g_slist_alloc0 ();
|
||||
new_list = _g_slist_alloc ();
|
||||
new_list->data = data;
|
||||
|
||||
if ((!tmp_list->next) && (cmp > 0))
|
||||
{
|
||||
tmp_list->next = new_list;
|
||||
new_list->next = NULL;
|
||||
return list;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user