18 userList->
users = NULL;
31 for (
size_t index = 0; index < userList->
users_count; index++)
35 free(userList->
users);
47 if (userList != NULL && user != NULL)
49 User** new_list = NULL;
50 if (userList->
users == NULL)
52 new_list = calloc(1,
sizeof(
User*));
57 new_list = userList->
users;
62 new_list = realloc(userList->
users, new_count *
sizeof(
User*));
67 userList->
users = new_list;
83 if (userList != NULL && userName != NULL)
85 for (
size_t index = 0; index < userList->
users_count; index++)
87 if (strcmp(userName, userList->
users[index]->
Name) == 0)
89 foundIndex = (int)index;
103 if (userList != NULL && userList->
users != NULL)
105 if (removeIndex >= 0 && (
size_t)removeIndex < userList->users_count)
108 for (
size_t userIndex = removeIndex; userIndex < userList->
allocated_count - 1; userIndex++)
110 userList->
users[userIndex] = userList->
users[userIndex + 1];
Represents a user with a name.
const char * Name
The name of the user.
Represents a list of users. Call UserList_Initialize() to start and UserList_Clear() to release all r...
User ** users
Array of pointers to User objects.
size_t users_count
Number of pointers in the users list.
size_t allocated_count
Size of the allocated users list.