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

Cleanup encodings init() #774

Merged
merged 2 commits into from Nov 27, 2015
Merged

Cleanup encodings init() #774

merged 2 commits into from Nov 27, 2015

Conversation

b4n
Copy link
Member

@b4n b4n commented Nov 25, 2015

No description provided.

@codebrainz
Copy link
Member

Not tested, but LGTM at a glance.


while (order < group_size) /* the biggest group has 13 elements */
/** TODO can it be optimized? ATM 882 runs at line "if (encoding->group ...)" */
Copy link
Member

Choose a reason for hiding this comment

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

Is this comment still relevant, and if so which "if" does it refer to? AFAICT there is no if(encoding->group line in the following loop.

Copy link
Member Author

Choose a reason for hiding this comment

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

well, it's still not great so maybe. And yeah, fixed the reference that I changed at some point but changed it back later.

Rewrite a part of `encodings_init()` to remove duplication and some
hard-coded values.

This gives us the item for UHC back, that was lost when adding CP932 in
9d9f40c, due to a missing update of
the hard-coded group elements count.
Simplify and optimize creation of the sorted menus by taking advantage
of the fact they might already be partially sorted, and that we can at
least add one entry to each group in each run.

This goes from 4032 runs to 882, which while definitely not optimal for
adding 126 items, is probably totally good enough and don't warrant
duplicating the encoding array and sort it.

Though, such optimization doesn't matter as it's not what takes time in
this function, which is probably rather the widgets creation.
@b4n
Copy link
Member Author

b4n commented Nov 27, 2015

@codebrainz fair enough, I used shiny C99 for loop declarations all through this function :)

@b4n b4n merged commit 4821770 into geany:master Nov 27, 2015
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

3 participants