aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2016-09-19 13:07:25 -0400
committerBo Yang <teboring@google.com>2016-09-19 17:43:19 -0700
commit96c469de680fadeac5f09339623cf1bae4cba48f (patch)
tree6af3d59ca2818ce37e36dbb837deeda570abc8fe
parent98835fb8f8a8f144f2a1eac0b833ff83f4a05f54 (diff)
downloadprotobuf-96c469de680fadeac5f09339623cf1bae4cba48f.tar.gz
protobuf-96c469de680fadeac5f09339623cf1bae4cba48f.tar.bz2
protobuf-96c469de680fadeac5f09339623cf1bae4cba48f.zip
Remove the custom key functions and just use the system provided defaults.
-rw-r--r--objectivec/GPBUnknownFieldSet.m43
1 files changed, 3 insertions, 40 deletions
diff --git a/objectivec/GPBUnknownFieldSet.m b/objectivec/GPBUnknownFieldSet.m
index 9ba1d65c..a7335f05 100644
--- a/objectivec/GPBUnknownFieldSet.m
+++ b/objectivec/GPBUnknownFieldSet.m
@@ -36,39 +36,6 @@
#import "GPBUtilities.h"
#import "GPBWireFormat.h"
-#pragma mark CFDictionaryKeyCallBacks
-
-// We use a custom dictionary here because our keys are numbers and
-// conversion back and forth from NSNumber was costing us performance.
-// If/when we move to C++ this could be done using a std::map and some
-// careful retain/release calls.
-
-static const void *GPBUnknownFieldSetKeyRetain(CFAllocatorRef allocator,
- const void *value) {
-#pragma unused(allocator)
- return value;
-}
-
-static void GPBUnknownFieldSetKeyRelease(CFAllocatorRef allocator,
- const void *value) {
-#pragma unused(allocator)
-#pragma unused(value)
-}
-
-static CFStringRef GPBUnknownFieldSetCopyKeyDescription(const void *value) {
- return CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%d"),
- (int)value);
-}
-
-static Boolean GPBUnknownFieldSetKeyEqual(const void *value1,
- const void *value2) {
- return value1 == value2;
-}
-
-static CFHashCode GPBUnknownFieldSetKeyHash(const void *value) {
- return (CFHashCode)value;
-}
-
#pragma mark Helpers
static void checkNumber(int32_t number) {
@@ -291,13 +258,9 @@ static void GPBUnknownFieldSetSerializedSizeAsMessageSet(const void *key,
int32_t number = [field number];
checkNumber(number);
if (!fields_) {
- CFDictionaryKeyCallBacks keyCallBacks = {
- // See description above for reason for using custom dictionary.
- 0, GPBUnknownFieldSetKeyRetain, GPBUnknownFieldSetKeyRelease,
- GPBUnknownFieldSetCopyKeyDescription, GPBUnknownFieldSetKeyEqual,
- GPBUnknownFieldSetKeyHash,
- };
- fields_ = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &keyCallBacks,
+ // Use a custom dictionary here because the keys are numbers and conversion
+ // back and forth from NSNumber isn't worth the cost.
+ fields_ = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL,
&kCFTypeDictionaryValueCallBacks);
}
ssize_t key = number;