]> git.ipfire.org Git - thirdparty/shadow.git/commit
Remove superfluous casts
authorAlejandro Colomar <alx@kernel.org>
Wed, 1 Feb 2023 12:50:48 +0000 (13:50 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 9 Feb 2023 16:03:03 +0000 (10:03 -0600)
commitbddcd9b0952f9b6f9b800dfafe6585b4ceb495cf
tree334678b05ec21547ab8c0fcdc98724447efbb235
parent66daa7423258cee3bef8240a3fc9b554bb7a69c0
Remove superfluous casts

-  Every non-const pointer converts automatically to void *.
-  Every pointer converts automatically to void *.
-  void * converts to any other pointer.
-  const void * converts to any other const pointer.
-  Integer variables convert to each other.

I changed the declaration of a few variables in order to allow removing
a cast.

However, I didn't attempt to edit casts inside comparisons, since they
are very delicate.  I also kept casts in variadic functions, since they
are necessary, and in allocation functions, because I have other plans
for them.

I also changed a few casts to int that are better as ptrdiff_t.

This change has triggered some warnings about const correctness issues,
which have also been fixed in this patch (see for example src/login.c).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
62 files changed:
contrib/adduser.c
lib/commonio.c
lib/fields.c
lib/get_gid.c
lib/get_pid.c
lib/get_uid.c
lib/getdef.c
lib/groupio.c
lib/gshadow.c
lib/port.c
lib/pwio.c
lib/sgroupio.c
lib/shadow.c
lib/shadowio.c
lib/subordinateio.c
lib/tcbfuncs.c
libmisc/addgrps.c
libmisc/age.c
libmisc/audit_help.c
libmisc/chowntty.c
libmisc/cleanup_group.c
libmisc/cleanup_user.c
libmisc/console.c
libmisc/copydir.c
libmisc/failure.c
libmisc/find_new_gid.c
libmisc/find_new_uid.c
libmisc/getgr_nam_gid.c
libmisc/gettime.c
libmisc/hushed.c
libmisc/isexpired.c
libmisc/limits.c
libmisc/log.c
libmisc/loginprompt.c
libmisc/obscure.c
libmisc/pam_pass_non_interactive.c
libmisc/prefix_flag.c
libmisc/pwd2spwd.c
libmisc/salt.c
libmisc/ttytype.c
libmisc/tz.c
libmisc/utmp.c
libmisc/yesno.c
libsubid/api.c
src/chage.c
src/chpasswd.c
src/faillog.c
src/groupadd.c
src/groupdel.c
src/lastlog.c
src/login.c
src/login_nopam.c
src/newgrp.c
src/newusers.c
src/passwd.c
src/pwck.c
src/pwconv.c
src/su.c
src/suauth.c
src/useradd.c
src/userdel.c
src/usermod.c