Refactor header inclusions and add main.h; implement searchPersonByUUID and addTimeEvent functions in users.c

This commit is contained in:
2025-04-24 19:53:52 +02:00
parent d60fcba0c8
commit e23ed280d8
9 changed files with 84 additions and 5 deletions
+16
View File
@@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifndef __MAIN_H__
#define __MAIN_H__
#define TRUE 1
#define FALSE 0
#define BYTE uint8_t
#define MIN_X_TERMINAL_SIZE 80
#define MIN_Y_TERMINAL_SIZE 30
int main(int argc, char const **argv);
#endif
+1 -2
View File
@@ -4,9 +4,8 @@
#include <ncurses.h>
#include <stdio.h>
#include <stdlib.h>
#include "main.h"
#define MIN_X_TERMINAL_SIZE 80
#define MIN_Y_TERMINAL_SIZE 30
void uartDialog(char *uart_adress, int terminal_x, int terminal_y);
+17 -2
View File
@@ -1,3 +1,5 @@
#include "main.h"
#include <stdint.h>
#include <time.h>
#include <unistd.h>
@@ -15,7 +17,9 @@ typedef struct person
uint32_t department;
time_t last_time_event;
uint32_t total;
time_t total;
BYTE available;
pthread_mutex_t lock;
} person_t;
@@ -40,7 +44,18 @@ uint16_t generateUUID(node_t *_head);
uint16_t searchUUIDByName(node_t *_head);
node_t *searchPersonByUUID(node_t *_head);
/**
* @brief Searches for a person in a linked list by their UUID.
*
* This function traverses a linked list starting from the given head node
* and searches for a node that matches the specified UUID.
*
* @param _head Pointer to the head node of the linked list.
* @param _uuid The UUID of the person to search for.
* @return Pointer to the node containing the person with the matching UUID,
* or NULL if no such person is found.
*/
node_t *searchPersonByUUID(node_t *_head, uint16_t _uuid);
/**
* @brief Adds a new person to the linked list.