-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NSDateFormatter issues #621
Fix NSDateFormatter issues #621
Conversation
Stop using so-called "hybrid approach" when implementation tries to determine in runtime what NSDateFormatter instance to use: the shared one or retrieved from thread dictionary. Now a library user must decide if thread-safe but more expensive behaviour is desired (default) or simple storing date formatter in ivar is sufficient (suitable for using formatter with a single logger).
…ride point to configure used NSDateFormatter.
Class cls = [self class]; | ||
SEL configMethodName = @selector(configureDateFormatter:); | ||
Method configMethod = class_getInstanceMethod(cls, configMethodName); | ||
for (;;) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably while (YES)
may be better. Nor sure if do
can be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rewrite using while
with non-trivial condition and without break
-s
…ueueLogFormatterMode` enum.
…ctive implementation of `configureDateFormatter:` Even seems more readable now.
@erysaj I think your implementation looks strong, so I will go ahead and merge it. We will keep an eye on this. |
Fix NSDateFormatter issues
Attempt to solve crashes in NSDateFormatter still observed in the wild.
Stop using so-called "hybrid approach" when implementation tries to determine in runtime what NSDateFormatter instance to use: the shared one or retrieved from thread dictionary. Now a library user must decide if thread-safe but more expensive behaviour is desired (default) or simple storing date formatter in ivar is sufficient (suitable for using formatter with a single logger).
A few more minor tweaks: