Add uc_strv_reverse
This commit is contained in:
@@ -130,3 +130,14 @@ int uc_strv_append_all(struct UCStrv *restrict a, struct UCStrv *restrict b, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uc_strv_reverse(struct UCStrv *strv)
|
||||
{
|
||||
for (size_t i = 0; i < strv->cnt / 2; i++) {
|
||||
|
||||
size_t k = strv->cnt - i - 1;
|
||||
char *tmp = strv->strings[i];
|
||||
|
||||
strv->strings[i] = strv->strings[k];
|
||||
strv->strings[k] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user