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

Mirror fix #780

Merged
merged 3 commits into from
Feb 7, 2018
Merged

Mirror fix #780

merged 3 commits into from
Feb 7, 2018

Conversation

hwangcc23
Copy link
Contributor

No description provided.

Fix the file descriptor leak.
Fix the dead code.

When reaching the line 45 in src/refdb.c, the condition "!tag_diff" must be true.
This was a dead code.

42:        if (tag_diff)
43:                return tag_diff;
44:        if (ref1->type != ref2->type)
45:                return !tag_diff ? ref1->type - ref2->type : ref2->type - ref1->type;
sizeof(struct file_finder_line **) is equal to sizeof(struct file_finder_line *) now,
but this is not a portable assumption.
This assumption wil be wrong after struct file_finder_line is changed in the future.

Use sizeof(*finder->line) instead of sizeof(finder->line).
@@ -42,7 +42,7 @@ ref_canonical_compare(const struct ref *ref1, const struct ref *ref2)
if (tag_diff)
return tag_diff;
if (ref1->type != ref2->type)
return !tag_diff ? ref1->type - ref2->type : ref2->type - ref1->type;
return (ref1->type - ref2->type);
Copy link
Owner

Choose a reason for hiding this comment

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

👍

@jonas
Copy link
Owner

jonas commented Feb 7, 2018

Thanks a lot.

@jonas jonas merged commit 58aa1d4 into jonas:master Feb 7, 2018
@hwangcc23 hwangcc23 deleted the mirror-fix branch February 7, 2018 14:48
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.

2 participants