Maelstrom: Merge pull request #2 from gapan/main

From 7bd26ffed7f3cb2571046480bda1ff11b21c2e34 Mon Sep 17 00:00:00 2001
From: George Vlahavas <[EMAIL REDACTED]>
Date: Wed, 5 Apr 2023 22:59:38 +0300
Subject: [PATCH 1/2] Don't use struct for typedef-name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Compilation would break with the following error on newer versions of
GCC:

buttonlist.h:19:24: error: using typedef-name ‘ButtonList::button’ after ‘struct’
   19 |                 struct button *belem;

This commit fixes this issue by removing the struct keyword.
---
 buttonlist.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/buttonlist.h b/buttonlist.h
index 7bb37b3b..ec01adca 100644
--- a/buttonlist.h
+++ b/buttonlist.h
@@ -16,7 +16,7 @@ class ButtonList {
 
 	void Add_Button(Uint16 x, Uint16 y, Uint16 width, Uint16 height, 
 						void (*callback)(void)) {
-		struct button *belem;
+		button *belem;
 		
 		for ( belem=&button_list; belem->next; belem=belem->next );
 		belem->next = new button;
@@ -30,7 +30,7 @@ class ButtonList {
 	}
 
 	void Activate_Button(Uint16 x, Uint16 y) {
-		struct button *belem;
+		button *belem;
 
 		for ( belem=button_list.next; belem; belem=belem->next ) {
 			if ( (x >= belem->x1) && (x <= belem->x2) &&
@@ -42,7 +42,7 @@ class ButtonList {
 	}
 
 	void Delete_Buttons(void) {
-		struct button *belem, *btemp;
+		button *belem, *btemp;
 
 		for ( belem=button_list.next; belem; ) {
 			btemp = belem;
@@ -58,7 +58,7 @@ class ButtonList {
 		Uint16 x1, y1;
 		Uint16 x2, y2;
 		void (*callback)(void);
-		struct button *next;
+		button *next;
 	} button;
 	button button_list;
 };

From 49fdcf02961fd8fa4015b029b327e82ea206a276 Mon Sep 17 00:00:00 2001
From: George Vlahavas <vlahavas@gmail.com>
Date: Wed, 5 Apr 2023 23:07:26 +0300
Subject: [PATCH 2/2] Fix implicit declaration warning for time function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This warning would show up when compiling:

Maelstrom-netd.c:93:15: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]
   93 |         now = time(NULL);

that was because the time function is actually declared in time.h
instead of sys/time.h, so include the former instead.
---
 Maelstrom-netd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Maelstrom-netd.c b/Maelstrom-netd.c
index 3e6e942e..530afd9a 100644
--- a/Maelstrom-netd.c
+++ b/Maelstrom-netd.c
@@ -7,7 +7,7 @@
 #include <signal.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/time.h>
+#include <time.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>