summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2014-08-17 23:03:22 -0400
committerGravatar Lioncash2014-08-17 23:12:20 -0400
commit98fa3f7cba22997aef8ec4d121584c2488389c38 (patch)
tree40585fc835fa8fc27882923a4439d88e7ae171de /src/core/hle/kernel/thread.cpp
parentMerge pull request #52 from lioncash/memory (diff)
downloadyuzu-98fa3f7cba22997aef8ec4d121584c2488389c38.tar.gz
yuzu-98fa3f7cba22997aef8ec4d121584c2488389c38.tar.xz
yuzu-98fa3f7cba22997aef8ec4d121584c2488389c38.zip
Core: Alter the kernel string functions to use std::string instead of const char*.
Most functions already operate on std::strings. This also removes the need to manually null terminate thread names.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 1d7ded6f6..554ec9756 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -2,13 +2,12 @@
2// Licensed under GPLv2 2// Licensed under GPLv2
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <stdio.h>
6
7#include <list>
8#include <algorithm> 5#include <algorithm>
9#include <vector> 6#include <cstdio>
7#include <list>
10#include <map> 8#include <map>
11#include <string> 9#include <string>
10#include <vector>
12 11
13#include "common/common.h" 12#include "common/common.h"
14#include "common/thread_queue_list.h" 13#include "common/thread_queue_list.h"
@@ -25,8 +24,8 @@ namespace Kernel {
25class Thread : public Kernel::Object { 24class Thread : public Kernel::Object {
26public: 25public:
27 26
28 const char* GetName() const { return name; } 27 std::string GetName() const { return name; }
29 const char* GetTypeName() const { return "Thread"; } 28 std::string GetTypeName() const { return "Thread"; }
30 29
31 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; } 30 static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Thread; }
32 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; } 31 Kernel::HandleType GetHandleType() const { return Kernel::HandleType::Thread; }
@@ -71,7 +70,7 @@ public:
71 70
72 std::vector<Handle> waiting_threads; 71 std::vector<Handle> waiting_threads;
73 72
74 char name[Kernel::MAX_NAME_LENGTH + 1]; 73 std::string name;
75}; 74};
76 75
77// Lists all thread ids that aren't deleted/etc. 76// Lists all thread ids that aren't deleted/etc.
@@ -336,9 +335,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio
336 thread->processor_id = processor_id; 335 thread->processor_id = processor_id;
337 thread->wait_type = WAITTYPE_NONE; 336 thread->wait_type = WAITTYPE_NONE;
338 thread->wait_handle = 0; 337 thread->wait_handle = 0;
339 338 thread->name = name;
340 strncpy(thread->name, name, Kernel::MAX_NAME_LENGTH);
341 thread->name[Kernel::MAX_NAME_LENGTH] = '\0';
342 339
343 return thread; 340 return thread;
344} 341}