Skip to content

Commit

Permalink
fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Jan 6, 2025
1 parent 2aa220f commit 75aea3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Source/AwsCommonRuntimeKit/crt/Allocator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import AwsCCommon
/*
* The default allocator.
* We need to declare `allocator` as mutable (`var`) instead of `let` because we override it with a tracing allocator in tests. This is not mutated anywhere else apart from the start of tests.
* Swift compiler doesn't let us compile this code due to global shared mutable state without locks, and complains that this is not safe. Disable the safety here since we won't modify it.
* Swift compiler doesn't let us compile this code in Swift 6 due to global shared mutable state without locks, and complains that this is not safe. Disable the safety here since we won't modify it.
*/
#if swift(>=5.10)
nonisolated(unsafe) var allocator = aws_default_allocator()!
#else
var allocator = aws_default_allocator()!
#endif

/// An allocator is used to allocate memory on the heap.
protocol Allocator {
Expand Down
4 changes: 2 additions & 2 deletions Source/Elasticurl/CommandLine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ struct CommandLineParser {
break
}
if let char = UnicodeScalar(Int(opt)) {
if get_cli_optarg() != nil {
argumentsDict[String(char)] = String(cString: get_cli_optarg())
if aws_get_cli_optarg() != nil {
argumentsDict[String(char)] = String(cString: aws_get_cli_optarg())
} else {
// if argument doesnt have a value just mark it as present in the dictionary
argumentsDict[String(char)] = true
Expand Down
2 changes: 1 addition & 1 deletion aws-common-runtime/aws-c-common

0 comments on commit 75aea3f

Please sign in to comment.