+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.
+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.
+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.
}
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;
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;
}
}
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)
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)
{
return list;
}
else
- return new_list;
+ {
+ new_list->prev = NULL;
+ return new_list;
+ }
}
GList*
{
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;
}
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;
{
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;
}
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;
}
{
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;
while (source)
{
GSource *next = source->next;
- g_source_destroy_internal (source, context, TRUE);
+ g_source_destroy_internal (source, context, FALSE);
source = next;
}
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);
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*
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)
{
return list;
}
else
- return new_list;
+ return new_list;
}
GSList*
{
GSList *new_list;
- new_list = _g_slist_alloc0 ();
+ new_list = _g_slist_alloc ();
new_list->data = data;
new_list->next = 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;
{
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;
}
break;
if (!last)
{
- node = g_slist_alloc ();
+ node = _g_slist_alloc ();
node->data = data;
node->next = slist;
}
else
{
- node = g_slist_alloc ();
+ node = _g_slist_alloc ();
node->data = data;
node->next = last->next;
last->next = node;
{
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;
if (!list)
{
- new_list = _g_slist_alloc0 ();
+ new_list = _g_slist_alloc ();
new_list->data = data;
+ new_list->next = NULL;
return new_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;
}