mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Fix c_list_length() function.
This commit is contained in:
parent
287a37d447
commit
679927b5a9
1 changed files with 12 additions and 6 deletions
|
@ -199,6 +199,10 @@ c_list_t *c_list_alloc(void) {
|
|||
c_list_t *c_list_remove(c_list_t *list, void *data) {
|
||||
c_list_t *temp = NULL;
|
||||
|
||||
if (list == NULL || data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
temp = list;
|
||||
|
||||
while (temp != NULL) {
|
||||
|
@ -275,13 +279,15 @@ c_list_t *c_list_previous(c_list_t *list) {
|
|||
* Gets the number of elements in a c_list
|
||||
*/
|
||||
unsigned long c_list_length(c_list_t *list) {
|
||||
unsigned long length = 0;
|
||||
unsigned long length = 1;
|
||||
|
||||
if (list != NULL) {
|
||||
while (list->next) {
|
||||
length++;
|
||||
list = list->next;
|
||||
}
|
||||
if (list == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (list->next) {
|
||||
length++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return length;
|
||||
|
|
Loading…
Reference in a new issue