summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-11-14 07:56:10 -0800
committerJason Ekstrand <[email protected]>2015-11-14 07:56:10 -0800
commit1469ccb7464836c752fa2664c36d8fae7e80606c (patch)
tree6f15e2eeb7e16e4085a0c58d50a36a4c12b231a5 /src/util
parente8f51fe4deb5082fece5f8cb167b89b0f03eb244 (diff)
parentf94e1d97381ec787c2abbbcd5265252596217e33 (diff)
Merge remote-tracking branch 'mesa-public/master' into vulkan
This pulls in Matt's big compiler refactor.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/list.h8
-rw-r--r--src/util/ralloc.c1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/util/list.h b/src/util/list.h
index d4b485174fc..f0dec5da608 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -99,6 +99,14 @@ static inline bool list_empty(struct list_head *list)
return list->next == list;
}
+/**
+ * Returns whether the list has exactly one element.
+ */
+static inline bool list_is_singular(const struct list_head *list)
+{
+ return list->next != NULL && list->next->next == list;
+}
+
static inline unsigned list_length(struct list_head *list)
{
struct list_head *node;
diff --git a/src/util/ralloc.c b/src/util/ralloc.c
index e07fce74f23..bb4cf9612eb 100644
--- a/src/util/ralloc.c
+++ b/src/util/ralloc.c
@@ -499,6 +499,7 @@ ralloc_vasprintf_rewrite_tail(char **str, size_t *start, const char *fmt,
if (unlikely(*str == NULL)) {
// Assuming a NULL context is probably bad, but it's expected behavior.
*str = ralloc_vasprintf(NULL, fmt, args);
+ *start = strlen(*str);
return true;
}