Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lamlee/JSONKit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: johnezang/JSONKit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 22, 2012

  1. Minor changes to hashing and cache aging algorithms.

    Hashing was changed slightly to exploit the fact that a significant amount of real world JSON strings / keys will have a high percentage of ASCII characters.
    
    Cache aging was modified to use an AIMD (additive increase, multiplicative decrease) policy.  When an item is found in the cache, its age is incremented by one using saturating arithmetic.  Ages are "quasi-randomly" aged using unsigned right shifts, or in other words its age is divided in half. Since ages decrease far more quickly than they increase, the cache can quickly adapt and converge on the "hot set".
    johnezang committed Mar 22, 2012
    Configuration menu
    Copy the full SHA
    02b983f View commit details
    Browse the repository at this point in the history

Commits on Jun 24, 2012

  1. Silences some warnings that newer versions of the compiler(s) complai…

    …n about.
    
    1. Some of the string format argument specifiers used `%lu` to display `NSUInteger` values.
    
    `%lu` specifies a type of `unsigned long`, and `NSUInteger` maps to either `unsigned int` or `unsigned long`, depending on whether or not you're targeting a 32-bit or 64-bit ABI, respectively.
    
    On a 32-bit architecture (at least for the architectures / compilers that JSONKit will be used on), `unsigned long` and `unsigned int` just so happen to use the same primitive type- a 4 byte 32-bit value.
    
    On a 64-bit architecture (again, for the architectures / compilers that JSONKit will be used on), `unsigned int` stays the same at 4 bytes, however `unsigned long` grows to 64-bits / 8 bytes.
    
    The long and the short of it is this that using `%lu` allows you to easily support 32-bit and 64-bits with out a lot of effort.
    
    However, technically, the C standard says that `int` and `long` are strictly different ranks, and it's generally considered poor form to take advantage of platform specific details in this case.
    
    The proper fix is to add explicit type casts to `unsigned long`.  This makes the implied behavior explicit, and eliminates the warnings from newer versions of the compiler.
    
    FYI, `gcc` did this for a long time and seems to be something that is either new or enabled by default in `clang` / `Xcode`.
    
    Other good warning flags you should consider enabling by default (from Xcode 4.3):
    
    Implicit Conversion to 32 Bit Type
    Suspicious Implicit Conversions
    Hidden Local Variables
    
    2. Newer compiler warns about deprecated `id` `isa` usage.
    
    I found jwz's commentary about breaking API's pretty funny: http://www.jwz.org/blog/2012/06/i-have-ported-xscreensaver-to-the-iphone/
    johnezang committed Jun 24, 2012
    Configuration menu
    Copy the full SHA
    5663f2d View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2012

  1. Add a #ifdef to silence a clang static analyzer false positive wa…

    …rning.
    
    The current (at the time of this writing) version of the `clang` static analyzer is complaing that the `objects` pointer is `NULL`.  This is a false positive warning from the analyzer.
    johnezang committed Jul 12, 2012
    Configuration menu
    Copy the full SHA
    8215763 View commit details
    Browse the repository at this point in the history
Loading