Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In printf, use %d instead of %i
Browse files Browse the repository at this point in the history
gperciva committed Jan 28, 2024
1 parent b1b329a commit 85f6498
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions STYLE
Original file line number Diff line number Diff line change
@@ -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.,
2 changes: 1 addition & 1 deletion tests/libscrypt-kdf/sample-libscrypt-kdf.c
Original file line number Diff line number Diff line change
@@ -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
@@ -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

2 changes: 1 addition & 1 deletion tests/shared_valgrind_functions.sh
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 85f6498

Please sign in to comment.