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

In printf, use %d instead of %i #381

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions STYLE
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ not erroneous.)
The first statement in main(), after variable declarations, should be
"WARNP_INIT;" in order to set the program name used for printing warnings.

We use %d rather than %i in printf and warn0/warnp strings.

In general, functions should be structured with one return statement per
status, e.g., one return() for success and one return() for failure. Errors
should be handled by using goto to enter the error return path, e.g.,
Expand Down
2 changes: 1 addition & 1 deletion tests/libscrypt-kdf/sample-libscrypt-kdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ main(void)
if (exitcode == 0)
printf("scrypt(): success\n");
else
printf("scrypt(): failure %i\n", exitcode);
printf("scrypt(): failure %d\n", exitcode);

return (exitcode);
}
2 changes: 1 addition & 1 deletion tests/shared_test_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ wait_while() {
while "$@"; do
# Notify user (if desired)
if [ "${VERBOSE}" -ne 0 ]; then
printf "waited\t%ims\t%s\n" \
printf "waited\t%dms\t%s\n" \
"${_wait_while_ms}" "$*" 1>&2
fi

Expand Down
2 changes: 1 addition & 1 deletion tests/shared_valgrind_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ _val_generalize() {
_val_generalize_i=1
while [ "${_val_generalize_i}" -le "${_val_generalize_num_segments}" ]; do
# Process segment
_val_seg "$(printf "%s%02i" \
_val_seg "$(printf "%s%02d" \
"${_val_generalize_filename}" "${_val_generalize_i}")"

# Advance to the next suppression.
Expand Down
Loading