From d29b876b5fe1d8525dfdeb01a9c0d1b750e0cdf8 Mon Sep 17 00:00:00 2001
From: Joshua Saxby <joshua.a.saxby@gmail.com>
Date: Fri, 29 Nov 2019 12:33:36 +0000
Subject: [PATCH] Fixed a small issue with `thread_exit_code()` The return type
 of this function was previously `const int *`, which is mistaken as the data
 type of the variable it returns is in fact `int`. This inconsistency passes
 silently as ints and pointers are often interchangeable in C, however it is
 not good practice hence the correction.

---
 threads/thread.c | 8 ++++----
 threads/thread.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/threads/thread.c b/threads/thread.c
index d8980f9..ed5fa63 100644
--- a/threads/thread.c
+++ b/threads/thread.c
@@ -254,14 +254,14 @@ thread_unblock (struct thread *t)
 const char *
 thread_name (void) 
 {
-  return thread_current ()->name;
+  return thread_current()->name;
 }
 
 /* Returns the exit code of the running thread. */
-const int *
-thread_exit_code (void) 
+int
+thread_exit_code (void)
 {
-  return thread_current ()->exit_code;
+  return thread_current()->exit_code;
 }
 
 /* Returns the running thread.
diff --git a/threads/thread.h b/threads/thread.h
index b57608e..2feb8cc 100644
--- a/threads/thread.h
+++ b/threads/thread.h
@@ -123,7 +123,7 @@ void thread_unblock (struct thread *);
 struct thread *thread_current (void);
 tid_t thread_tid (void);
 const char *thread_name (void);
-const int *thread_exit_code (void);
+int thread_exit_code (void);
 
 void thread_exit (void) NO_RETURN;
 void thread_yield (void);
-- 
GitLab