]> git.ipfire.org Git - thirdparty/shadow.git/commit
Use safer allocation macros
authorAlejandro Colomar <alx@kernel.org>
Sat, 4 Feb 2023 21:41:18 +0000 (22:41 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 24 Feb 2023 02:28:43 +0000 (20:28 -0600)
commitefbbcade43ff2dca2b7a271dcbd186be08ac1913
tree757f4683e05da7db80889a9fd4e1c6aa5dbe00ef
parent6e58c1275252f3314d1aa5cc4d7e7f9068e3a902
Use safer allocation macros

Use of these macros, apart from the benefits mentioned in the commit
that adds the macros, has some other good side effects:

-  Consistency in getting the size of the object from sizeof(type),
   instead of a mix of sizeof(type) sometimes and sizeof(*p) other
   times.

-  More readable code: no casts, and no sizeof(), so also shorter lines
   that we don't need to cut.

-  Consistency in using array allocation calls for allocations of arrays
   of objects, even when the object size is 1.

Cc: Valentin V. Bartenev <vbartenev@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
44 files changed:
lib/commonio.c
lib/getdef.c
lib/groupio.c
lib/groupmem.c
lib/gshadow.c
lib/nss.c
lib/pwmem.c
lib/run_part.c
lib/sgetgrent.c
lib/sgroupio.c
lib/shadowmem.c
lib/sssd.c
lib/subordinateio.c
libmisc/addgrps.c
libmisc/agetpass.c
libmisc/copydir.c
libmisc/env.c
libmisc/find_new_gid.c
libmisc/find_new_uid.c
libmisc/idmapping.c
libmisc/list.c
libmisc/loginprompt.c
libmisc/mail.c
libmisc/obscure.c
libmisc/pam_pass_non_interactive.c
libmisc/prefix_flag.c
libmisc/setupenv.c
libmisc/utmp.c
libmisc/xgetXXbyYY.c
src/gpasswd.c
src/groupmems.c
src/groupmod.c
src/groups.c
src/id.c
src/login.c
src/newgrp.c
src/newusers.c
src/passwd.c
src/su.c
src/useradd.c
src/userdel.c
src/usermod.c
src/vipw.c
tests/libsubid/04_nss/libsubid_zzz.c