Skip to content

Commit

Permalink
In printf, use %d instead of %i
Browse files Browse the repository at this point in the history
  • Loading branch information
gperciva committed Jan 28, 2024
1 parent b1b329a commit 85f6498
Show file tree
Hide file tree
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
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

0 comments on commit 85f6498

Please sign in to comment.