forked from OSchip/llvm-project
[TSan][libdispatch] Replace usage of NSMutableData with stack array
Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60477 llvm-svn: 358205
This commit is contained in:
parent
edea731af2
commit
3e58f94ced
|
@ -17,8 +17,8 @@ int main(int argc, const char *argv[]) {
|
|||
0666, queue, ^(int error) { });
|
||||
dispatch_io_set_high_water(channel, 1);
|
||||
|
||||
NSData *ns_data = [NSMutableData dataWithLength:1000];
|
||||
dispatch_data_t data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
char buf[1000];
|
||||
dispatch_data_t data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
|
||||
my_global++;
|
||||
dispatch_io_write(channel, 0, data, queue, ^(bool done, dispatch_data_t remainingData, int error) {
|
||||
|
|
|
@ -21,8 +21,8 @@ int main(int argc, const char *argv[]) {
|
|||
sem = dispatch_semaphore_create(0);
|
||||
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
|
||||
path = ns_path.fileSystemRepresentation;
|
||||
NSData *ns_data = [NSMutableData dataWithLength:1000];
|
||||
data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
char buf[1000];
|
||||
data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
|
||||
dispatch_io_t channel = dispatch_io_create_with_path(DISPATCH_IO_STREAM, path, O_CREAT | O_WRONLY, 0666, queue, ^(int error) { });
|
||||
if (! channel) abort();
|
||||
|
|
|
@ -17,8 +17,8 @@ int main(int argc, const char *argv[]) {
|
|||
sem = dispatch_semaphore_create(0);
|
||||
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
|
||||
path = ns_path.fileSystemRepresentation;
|
||||
NSData *ns_data = [NSMutableData dataWithLength:1000];
|
||||
data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
char buf[1000];
|
||||
data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
|
||||
dispatch_io_t channel = dispatch_io_create_with_path(DISPATCH_IO_STREAM, path, O_CREAT | O_WRONLY, 0666, queue, ^(int error) { });
|
||||
if (! channel) abort();
|
||||
|
|
|
@ -23,8 +23,8 @@ int main(int argc, const char *argv[]) {
|
|||
sem = dispatch_semaphore_create(0);
|
||||
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
|
||||
path = ns_path.fileSystemRepresentation;
|
||||
NSData *ns_data = [NSMutableData dataWithLength:1000];
|
||||
data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
char buf[1000];
|
||||
data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
|
||||
dispatch_io_t channel = dispatch_io_create_with_path(DISPATCH_IO_STREAM, path, O_CREAT | O_WRONLY, 0666, queue, ^(int error) { });
|
||||
if (! channel) abort();
|
||||
|
|
|
@ -100,8 +100,8 @@ int main(int argc, const char *argv[]) {
|
|||
sem = dispatch_semaphore_create(0);
|
||||
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
|
||||
path = ns_path.fileSystemRepresentation;
|
||||
NSData *ns_data = [NSMutableData dataWithLength:1000];
|
||||
data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
char buf[1000];
|
||||
data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
|
||||
test_dispatch_io_write();
|
||||
test_dispatch_write();
|
||||
|
|
Loading…
Reference in New Issue