Skip to content

Commit

Permalink
When commiting the fix for hash % dictionary->capacity, some local, i…
Browse files Browse the repository at this point in the history
…n progress edits made it in to the commit. This change backs them out.
  • Loading branch information
johnezang committed Mar 31, 2011
1 parent 18a0a3a commit 2e6ccf4
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions JSONKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -2525,7 +2525,6 @@ static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *object
return(0);
}

#if 0
// When we encounter a class that we do not handle, and we have either a delegate or block that the user supplied to format unsupported classes,
// we "re-run" the object check. However, we re-run the object check exactly ONCE. If the user supplies an object that isn't one of the
// supported classes, we fail the second type (i.e., double fault error).
Expand Down Expand Up @@ -2553,39 +2552,7 @@ static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *object
else { jk_encode_error(encodeState, @"Unable to serialize object class %@ that was returned by the unsupported class formatter. Original object class was %@.", (object == NULL) ? @"NULL" : NSStringFromClass([object class]), NSStringFromClass([encodeCacheObject class])); return(1); }
}
}
#else

// When we encounter a class that we do not handle, and we have either a delegate or block that the user supplied to format unsupported classes,
// we "re-run" the object check. However, we re-run the object check exactly ONCE. If the user supplies an object that isn't one of the
// supported classes, we fail the second type (i.e., double fault error).
//BOOL rerunningAfterClassFormatter = NO;
//rerunAfterClassFormatter:

if(
#ifdef __BLOCKS__
((encodeState->classFormatterBlock) && ((object = encodeState->classFormatterBlock(object)) == NULL)) ||
#endif
((encodeState->classFormatterIMP) && ((object = encodeState->classFormatterIMP(encodeState->classFormatterDelegate, encodeState->classFormatterSelector, object)) == NULL)) ) { goto formatterError; }

if(JK_EXPECT_T(object->isa == encodeState->fastClassLookup.stringClass)) { isClass = JKClassString; }
else if(JK_EXPECT_T(object->isa == encodeState->fastClassLookup.numberClass)) { isClass = JKClassNumber; }
else if(JK_EXPECT_T(object->isa == encodeState->fastClassLookup.dictionaryClass)) { isClass = JKClassDictionary; }
else if(JK_EXPECT_T(object->isa == encodeState->fastClassLookup.arrayClass)) { isClass = JKClassArray; }
else if(JK_EXPECT_T(object->isa == encodeState->fastClassLookup.nullClass)) { isClass = JKClassNull; }
else {
if(JK_EXPECT_T([object isKindOfClass:[NSString class]])) { encodeState->fastClassLookup.stringClass = object->isa; isClass = JKClassString; }
else if(JK_EXPECT_T([object isKindOfClass:[NSNumber class]])) { encodeState->fastClassLookup.numberClass = object->isa; isClass = JKClassNumber; }
else if(JK_EXPECT_T([object isKindOfClass:[NSDictionary class]])) { encodeState->fastClassLookup.dictionaryClass = object->isa; isClass = JKClassDictionary; }
else if(JK_EXPECT_T([object isKindOfClass:[NSArray class]])) { encodeState->fastClassLookup.arrayClass = object->isa; isClass = JKClassArray; }
else if(JK_EXPECT_T([object isKindOfClass:[NSNull class]])) { encodeState->fastClassLookup.nullClass = object->isa; isClass = JKClassNull; }
else {
formatterError:
if(object == encodeCacheObject) { jk_encode_error(encodeState, @"Unable to serialize object class %@.", NSStringFromClass([encodeCacheObject class])); return(1); }
else { jk_encode_error(encodeState, @"Unable to serialize object class %@ that was returned by the unsupported class formatter. Original object class was %@.", (object == NULL) ? @"NULL" : NSStringFromClass([object class]), NSStringFromClass([encodeCacheObject class])); return(1); }
}
}

#endif
// This is here for the benefit of the optimizer. It allows the optimizer to do loop invariant code motion for the JKClassArray
// and JKClassDictionary cases when printing simple, single characters via jk_encode_write(), which is actually a macro:
// #define jk_encode_write1(es, dc, f) (_jk_encode_prettyPrint ? jk_encode_write1slow(es, dc, f) : jk_encode_write1fast(es, dc, f))
Expand Down

0 comments on commit 2e6ccf4

Please sign in to comment.