Skip to content
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

Small optimize by removing redundant code #56

Merged
merged 2 commits into from
Sep 30, 2018

Conversation

zhongwuzw
Copy link
Contributor

  1. initialize already thread-safe, and only be called once by self == MMKV.class checking, so we can remove dispatch_once_t safely.
  2. NSDictionary may better.

@@ -257,7 +254,7 @@ - (void)loadFromFile {
if (m_cryptor) {
inputBuffer = decryptBuffer(*m_cryptor, inputBuffer);
}
m_dic = [MiniPBCoder decodeContainerOfClass:NSMutableDictionary.class withValueClass:NSData.class fromData:inputBuffer];
m_dic = [MiniPBCoder decodeContainerOfClass:NSDictionary.class withValueClass:NSData.class fromData:inputBuffer];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It's confusing. m_dic is declared as NSMutableDictionary, and new key-values will be added into m_dic. It's better to keep things alike.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lingol Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants