Skip to content

Commit 217569a

Browse files
committed
Use utf8 cound for C strings
1 parent ec9b44b commit 217569a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/PrettyStackTrace/PrettyStackTrace.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ private class PrettyStackTraceManager {
7878
init() {
7979
let msg = "Stack dump:\n"
8080
stackDumpMsg = StackEntry(prev: nil,
81-
data: strndup(msg, msg.count),
82-
count: msg.count)
81+
data: strndup(msg, msg.utf8.count),
82+
count: msg.utf8.count)
8383
}
8484

8585
/// Pushes the description of a trace entry to the stack.
8686
func push(_ entry: TraceEntry) {
87-
let str = "\(entry.description)\n"
87+
let str = " \(entry.description)\n"
8888
let newEntry = StackEntry(prev: stack,
8989
data: strndup(str, str.count),
9090
count: str.count)

0 commit comments

Comments
 (0)