diff options
author | Jason Ekstrand <[email protected]> | 2015-11-14 07:56:10 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-11-14 07:56:10 -0800 |
commit | 1469ccb7464836c752fa2664c36d8fae7e80606c (patch) | |
tree | 6f15e2eeb7e16e4085a0c58d50a36a4c12b231a5 /src/util | |
parent | e8f51fe4deb5082fece5f8cb167b89b0f03eb244 (diff) | |
parent | f94e1d97381ec787c2abbbcd5265252596217e33 (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.h | 8 | ||||
-rw-r--r-- | src/util/ralloc.c | 1 |
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; } |