mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
u/string_list: Add constructor from existing list
This commit is contained in:
parent
ee366e16e5
commit
171a3830b9
|
@ -47,6 +47,17 @@ u_string_list_create_with_capacity(uint32_t capacity)
|
|||
}
|
||||
}
|
||||
|
||||
struct u_string_list *
|
||||
u_string_list_create_from_list(struct u_string_list *usl)
|
||||
{
|
||||
try {
|
||||
auto ret = std::make_unique<u_string_list>(xrt::auxiliary::util::StringList{usl->list});
|
||||
return ret.release();
|
||||
} catch (std::exception const &) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
u_string_list_get_size(const struct u_string_list *usl)
|
||||
|
|
|
@ -40,6 +40,14 @@ u_string_list_create(void);
|
|||
struct u_string_list *
|
||||
u_string_list_create_with_capacity(uint32_t capacity);
|
||||
|
||||
/*!
|
||||
* @brief Create a new string list from an existing string list.
|
||||
*
|
||||
* @public @memberof u_string_list
|
||||
*/
|
||||
struct u_string_list *
|
||||
u_string_list_create_from_list(struct u_string_list *usl);
|
||||
|
||||
/*!
|
||||
* @brief Retrieve the number of elements in the list
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue