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

print.h,makefile: use switch..case and various other small changes #9

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

rilysh
Copy link

@rilysh rilysh commented May 13, 2024

Commit messages:

print.h: replace else..if with switch..case and use fput* functions

* Replace all else..if branches with switch..case. A optimizing
compiler might be able to create a lookup table instead relying
on the branches.

* Replace fprintf() with fputc() and fputs(), for strings that
do not require formatting. C compilers such as TCC (that doesn't
replace fprintf() calls, for (non-formatting) strings with fput*
functions) can make use of this. This shall increase the performance
a bit or so when compiled with TCC.

print.h: disable clang "unused variable" warning

Makefile: add uninstall and clean sections

* It's useful to have an uninstall section, so when a user need
to uninstall these files, they don't have to track them down,
where they might have been installed.

* Adding clean as well, for the demo.

rilysh and others added 5 commits May 13, 2024 11:05
* Replace all else..if branches with switch..case. A optimizing
compiler might be able to create a lookup table instead relying
on the branches.

* Replace fprintf() with fputc() and fputs(), for strings that
do not require formatting. C compilers such as TCC (that doesn't
replace fprintf() calls, for (non-formatting) strings with fput*
functions) can make use of this. This shall increase the performance
a bit or so when compiled with TCC.
* It's useful to have an uninstall section, so when a user need
to uninstall these files, they don't have to track them down,
where they might have been installed.

* Adding clean as well, for the demo.
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