aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
authorGravatar Michael Lumish <mlumish@google.com>2015-07-20 10:02:44 -0700
committerGravatar Michael Lumish <mlumish@google.com>2015-07-20 10:02:44 -0700
commit51c69e6a6f4dbd0d90491f091a61e6b927e04b63 (patch)
treec7dc4bb07c77b8ed190ee0a6bfa31758ae361227 /src/objective-c
parent03f0bd678625ca8c27d9d8f8f6982486896c13b9 (diff)
parentbc970ae23b90c443ed8ebb379f4bebda2ceef833 (diff)
Merge pull request #2525 from jcanizales/fix-emptywriter
Fix [GRXWriter emptyWriter] not being reusable.
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/RxLibrary/GRXImmediateWriter.m19
1 files changed, 3 insertions, 16 deletions
diff --git a/src/objective-c/RxLibrary/GRXImmediateWriter.m b/src/objective-c/RxLibrary/GRXImmediateWriter.m
index b6d2b2cac0..3edae788ab 100644
--- a/src/objective-c/RxLibrary/GRXImmediateWriter.m
+++ b/src/objective-c/RxLibrary/GRXImmediateWriter.m
@@ -76,28 +76,15 @@
}
+ (GRXWriter *)writerWithValue:(id)value {
- if (value) {
- return [self writerWithEnumerator:[NSEnumerator grx_enumeratorWithSingleValue:value]];
- } else {
- return [self emptyWriter];
- }
+ return [self writerWithEnumerator:[NSEnumerator grx_enumeratorWithSingleValue:value]];
}
+ (GRXWriter *)writerWithError:(NSError *)error {
- if (error) {
- return [self writerWithEnumerator:nil error:error];
- } else {
- return [self emptyWriter];
- }
+ return [self writerWithEnumerator:nil error:error];
}
+ (GRXWriter *)emptyWriter {
- static GRXImmediateWriter *emptyWriter;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- emptyWriter = [self writerWithEnumerator:nil error:nil];
- });
- return emptyWriter;
+ return [self writerWithEnumerator:nil error:nil];
}
#pragma mark Conformance with GRXWriter