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

refactor: Make tox-bootstrapd use bool instead of int #2692

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

nurupo
Copy link
Member

@nurupo nurupo commented Feb 17, 2024

A continuation of the cleanup done in #2621.

tox-bootrstrapd historically had used ints for boolean values, as it was initially written in C89 which has no stdbool.h. Since then it has modernized and moved on to using C11, but the usage of the int type to represent boolean values, "boolean ints", remained. Recently, driven by a desire to eliminate implicit int-to-bool conversion, @iphydf did a cleanup in b7404f2, changing some of the boolean ints to bools and doing manual int-to-bool conversion on the remaining boolean ints. This left the codebase in an inconsistent state of both ints and bools now being used to represent boolean values, not to mention that the explicit int-to-bool conversions are a bit ugly. The only boolean ints that remained are those stemming from libconfig's config_lookup_bool() taking an *int parameter to return a boolean value, as libconfig still uses C89. This commit adds a wrapper function around libconfig's config_lookup_bool() that takes a *bool instead, eliminating the remaining boolean ints and majority of the explicit int-to-bool conversions in tox-bootstrapd.


This change is Reviewable

@nurupo nurupo added this to the v0.2.20 milestone Feb 17, 2024
Copy link

codecov bot commented Feb 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.09%. Comparing base (fa20168) to head (395e048).
Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2692      +/-   ##
==========================================
+ Coverage   73.03%   73.09%   +0.06%     
==========================================
  Files         149      149              
  Lines       30531    30531              
==========================================
+ Hits        22298    22318      +20     
+ Misses       8233     8213      -20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nurupo nurupo marked this pull request as ready for review March 29, 2024 10:46
@nurupo

This comment was marked as off-topic.

@nurupo

This comment was marked as off-topic.

A continuation of the cleanup done in
b7404f2.

tox-bootrstrapd historically had used ints for boolean values, as it was
initially written in C89 which has no stdbool.h. Since then it has
modernized and moved on to using C11, but the usage of the int type to
represent boolean values, "boolean ints", remained. Recently, driven by
a desire to eliminate implicit int-to-bool conversion, @iphydf did a
cleanup in b7404f2, changing some of
the boolean ints to bools and doing manual int-to-bool conversion on the
remaining boolean ints. This left the codebase in an inconsistent state
of both ints and bools now being used to represent boolean values, not
to mention that the explicit int-to-bool conversions are a bit ugly. The
only boolean ints that remained are those stemming from libconfig's
config_lookup_bool() taking an *int parameter to return a boolean value,
as libconfig still uses C89. This commit adds a wrapper function around
libconfig's config_lookup_bool() that takes a *bool instead, eliminating
the remaining boolean ints and majority of the explicit int-to-bool
conversions in tox-bootstrapd.
Copy link
Member

@iphydf iphydf left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

@iphydf iphydf merged commit 5752fc2 into TokTok:master Nov 7, 2024
62 checks passed
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