Add searchUUIDByName function to retrieve UUID by name and surname; improve formatting in users.c

This commit is contained in:
2025-04-25 16:32:18 +02:00
parent e23ed280d8
commit b9a4b77a40
2 changed files with 64 additions and 21 deletions
+14 -2
View File
@@ -42,7 +42,19 @@ typedef struct node
*/
uint16_t generateUUID(node_t *_head);
uint16_t searchUUIDByName(node_t *_head);
/**
* @brief Searches for a UUID associated with a user by their name and surname.
*
* This function traverses a linked list of nodes to find a user whose name
* and surname match the provided parameters. If a match is found, it returns
* a pointer to the UUID associated with that user.
*
* @param _head Pointer to the head of the linked list.
* @param _name Pointer to a string containing the user's first name.
* @param _surname Pointer to a string containing the user's surname.
* @return Pointer to the UUID of the user if found, or 0 if no match is found.
*/
uint16_t *searchUUIDByName(node_t *_head, char *_name, char *_surname);
/**
* @brief Searches for a person in a linked list by their UUID.
@@ -68,7 +80,7 @@ node_t *searchPersonByUUID(node_t *_head, uint16_t _uuid);
* @param _name Pointer to a string containing the person's first name.
* @param _surname Pointer to a string containing the person's last name.
* @param _department The department number to which the person belongs.
*
*
* @return int Returns 1 if the person was successfully added, otherwise 0 on failure.
*
* @note Memory for the name and surname is dynamically allocated. It is the caller's