gpointer ug_datalist_copy (gpointer datalist) { UgDatalist* newlist; UgDatalist* newdata; UgDatalist* src; newlist = NULL; for (src = ug_datalist_last (datalist); src; src = src->prev) { if (src->iface->assign) { newdata = ug_data1_copy (src); newlist = ug_datalist_prepend (newlist, newdata); } } return newlist; }
gpointer ug_dataset_alloc_front (UgDataset* dataset, const UgData1Interface* iface) { UgDatalist** list; UgDatalist* link; // assert (iface != NULL); list = ug_dataset_get_list (dataset, iface); if (list == NULL) list = ug_dataset_alloc_list (dataset, iface); link = ug_data1_new (iface); *list = ug_datalist_prepend (*list, link); return link; }
void ug_plugin_post (UgPlugin* plugin, UgMessage* message) { UgMessage* link; message->src = plugin; g_mutex_lock (&plugin->lock); // Remove repeated progress message from queue link = plugin->messages; if (message->type == UG_MESSAGE_PROGRESS && link && link->type == UG_MESSAGE_PROGRESS) plugin->messages = link->next; else link = NULL; // prepend new message plugin->messages = ug_datalist_prepend (plugin->messages, message); g_mutex_unlock (&plugin->lock); // free repeated progress message here to reduce lock time if (link) ug_data_free (link); }