#include "mtypes.h"
#include "version.h"
#include "util/hash_table.h"
-#include "util/simple_list.h"
+#include "util/list.h"
static simple_mtx_t DynamicIDMutex = _SIMPLE_MTX_INITIALIZER_NP;
*/
struct gl_debug_element
{
- struct simple_node link;
+ struct list_head link;
GLuint ID;
/* at which severity levels (mesa_debug_severity) is the message enabled */
struct gl_debug_namespace
{
- struct simple_node Elements;
+ struct list_head Elements;
GLbitfield DefaultState;
};
static void
debug_namespace_init(struct gl_debug_namespace *ns)
{
- make_empty_list(&ns->Elements);
+ list_inithead(&ns->Elements);
/* Enable all the messages with severity HIGH or MEDIUM by default */
ns->DefaultState = (1 << MESA_DEBUG_SEVERITY_MEDIUM ) |
static void
debug_namespace_clear(struct gl_debug_namespace *ns)
{
- struct simple_node *node, *tmp;
-
- foreach_s(node, tmp, &ns->Elements)
- free(node);
+ list_for_each_entry_safe(struct gl_debug_element, elem, &ns->Elements, link)
+ free(elem);
}
static bool
debug_namespace_copy(struct gl_debug_namespace *dst,
const struct gl_debug_namespace *src)
{
- struct simple_node *node;
-
dst->DefaultState = src->DefaultState;
- make_empty_list(&dst->Elements);
- foreach(node, &src->Elements) {
- const struct gl_debug_element *elem =
- (const struct gl_debug_element *) node;
+ list_inithead(&dst->Elements);
+ list_for_each_entry(struct gl_debug_element, elem, &src->Elements, link) {
struct gl_debug_element *copy;
copy = malloc(sizeof(*copy));
copy->ID = elem->ID;
copy->State = elem->State;
- insert_at_tail(&dst->Elements, ©->link);
+ list_addtail(©->link, &dst->Elements);
}
return true;
const uint32_t state = (enabled) ?
((1 << MESA_DEBUG_SEVERITY_COUNT) - 1) : 0;
struct gl_debug_element *elem = NULL;
- struct simple_node *node;
/* find the element */
- foreach(node, &ns->Elements) {
- struct gl_debug_element *tmp = (struct gl_debug_element *) node;
+ list_for_each_entry(struct gl_debug_element, tmp, &ns->Elements, link) {
if (tmp->ID == id) {
elem = tmp;
break;
/* we do not need the element if it has the default state */
if (ns->DefaultState == state) {
if (elem) {
- remove_from_list(&elem->link);
+ list_del(&elem->link);
free(elem);
}
return true;
return false;
elem->ID = id;
- insert_at_tail(&ns->Elements, &elem->link);
+ list_addtail(&elem->link, &ns->Elements);
}
elem->State = state;
enum mesa_debug_severity severity,
bool enabled)
{
- struct simple_node *node, *tmp;
uint32_t mask, val;
/* set all elements to the same state */
if (severity == MESA_DEBUG_SEVERITY_COUNT) {
ns->DefaultState = (enabled) ? ((1 << severity) - 1) : 0;
debug_namespace_clear(ns);
- make_empty_list(&ns->Elements);
+ list_inithead(&ns->Elements);
return;
}
ns->DefaultState = (ns->DefaultState & ~mask) | val;
- foreach_s(node, tmp, &ns->Elements) {
- struct gl_debug_element *elem = (struct gl_debug_element *) node;
-
+ list_for_each_entry_safe(struct gl_debug_element, elem, &ns->Elements,
+ link) {
elem->State = (elem->State & ~mask) | val;
if (elem->State == ns->DefaultState) {
- remove_from_list(node);
- free(node);
+ list_del(&elem->link);
+ free(elem);
}
}
}
debug_namespace_get(const struct gl_debug_namespace *ns, GLuint id,
enum mesa_debug_severity severity)
{
- struct simple_node *node;
uint32_t state;
state = ns->DefaultState;
- foreach(node, &ns->Elements) {
- struct gl_debug_element *elem = (struct gl_debug_element *) node;
-
+ list_for_each_entry(struct gl_debug_element, elem, &ns->Elements, link) {
if (elem->ID == id) {
state = elem->State;
break;