added "why2_" at the beginning of chat-misc functions' identificators

i forgor again
This commit is contained in:
Václav Šmejkal 2023-02-21 12:33:33 +01:00
parent 4623f76f97
commit f31216f387
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59
4 changed files with 12 additions and 12 deletions

View File

@ -19,9 +19,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef WHY2_CHAT_MISC_H
#define WHY2_CHAT_MISC_H
void send_socket(char *text, int socket); //send socket.... wtf did you expect
char *read_socket(int socket); //read lol
void *communicate_thread(void *arg); //COMMUNICATION THREAD
void register_connection(int socket); //ADD SOCKET TO LIST
void why2_send_socket(char *text, int socket); //send socket.... wtf did you expect
char *why2_read_socket(int socket); //read lol
void *why2_communicate_thread(void *arg); //COMMUNICATION THREAD
void why2_register_connection(int socket); //ADD SOCKET TO LIST
#endif

View File

@ -52,7 +52,7 @@ int main(void)
printf("%s\n", line);
send_socket(line, listen_socket);
why2_send_socket(line, listen_socket);
if (strcmp(line, "!exit\n") == 0) //USER REQUESTED PROGRAM EXIT
{

View File

@ -47,7 +47,7 @@ int main(void)
if (accepted == -1) continue;
pthread_create(&thread, NULL, communicate_thread, &accepted);
pthread_create(&thread, NULL, why2_communicate_thread, &accepted);
}
return 0;

View File

@ -107,7 +107,7 @@ node_t *get_node(int connection)
}
//GLOBAL
void send_socket(char *text, int socket)
void why2_send_socket(char *text, int socket)
{
unsigned short text_length = (unsigned short) strlen(text);
char *final = why2_calloc(strlen(text) + 2, sizeof(char));
@ -127,7 +127,7 @@ void send_socket(char *text, int socket)
why2_deallocate(final);
}
void *communicate_thread(void *arg)
void *why2_communicate_thread(void *arg)
{
printf("User connected.\t%d\n", *((int*) arg));
@ -136,7 +136,7 @@ void *communicate_thread(void *arg)
while (time(NULL) - startTime < 86400) //KEEP COMMUNICATION ALIVE FOR 24 HOURS
{
received = read_socket(*((int*) arg)); //READ
received = why2_read_socket(*((int*) arg)); //READ
if (received == NULL) return NULL; //FAILED; EXIT THREAD
@ -156,7 +156,7 @@ void *communicate_thread(void *arg)
return NULL;
}
char *read_socket(int socket)
char *why2_read_socket(int socket)
{
if (socket == -1)
{
@ -183,7 +183,7 @@ char *read_socket(int socket)
return content_buffer;
}
void register_connection(int socket)
void why2_register_connection(int socket)
{
push_to_list(socket); //PUSH
push_to_list(socket); //SEND
}