]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/: Rename CALLOC() => calloc_T()
authorAlejandro Colomar <alx@kernel.org>
Sat, 15 Nov 2025 21:08:15 +0000 (22:08 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sat, 6 Dec 2025 03:22:45 +0000 (21:22 -0600)
The 'T' in the name notes that this API is a type-safe variant of the
API it wraps.  This makes the names more explicative.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/alloc/calloc.h
lib/find_new_gid.c
lib/find_new_uid.c
lib/groupio.c
lib/groupmem.c
lib/idmapping.c
lib/pam_pass_non_interactive.c
lib/pwmem.c
lib/sgroupio.c
lib/shadowmem.c

index f9dc9ff6122504a8230a36c760edbdae204d507d..f11298c0ae225c6e2f6b74f6628c537822600e09 100644 (file)
 #include "sizeof.h"
 
 
-#define CALLOC(n, T)   CALLOC_(n, typeas(T))
-#define CALLOC_(n, T)                                                 \
+// calloc_T - calloc type-safe
+#define calloc_T(n, T)   calloc_T_(n, typeas(T))
+#define calloc_T_(n, T)                                               \
 ({                                                                    \
        (T *){calloc(n, sizeof(T))};                                  \
 })
 
 
-#define XCALLOC(n, T)  exit_if_null(CALLOC(n, T))
+#define XCALLOC(n, T)  exit_if_null(calloc_T(n, T))
 
 
 #endif  // include guard
index 0d74945c106fb2f170600ac0ac59fb29de118223..dfcc9143d87ec436dfb1b38b5a22a6ad6f779137 100644 (file)
@@ -235,7 +235,7 @@ int find_new_gid (bool sys_group,
         */
 
        /* Create an array to hold all of the discovered GIDs */
-       used_gids = CALLOC (gid_max + 1, bool);
+       used_gids = calloc_T(gid_max + 1, bool);
        if (NULL == used_gids) {
                fprintf (log_get_logfd(),
                         _("%s: failed to allocate memory: %s\n"),
index 4cce681316bf9e72eede36bdff3aa795ed677818..3cafef603ad1197d5fd9efd47a3514970ab549fd 100644 (file)
@@ -234,7 +234,7 @@ int find_new_uid(bool sys_user,
         */
 
        /* Create an array to hold all of the discovered UIDs */
-       used_uids = CALLOC(uid_max + 1, bool);
+       used_uids = calloc_T(uid_max + 1, bool);
        if (NULL == used_uids) {
                fprintf (log_get_logfd(),
                         _("%s: failed to allocate memory: %s\n"),
index e1d984de37b031e7728ce9421334031f7839a3ff..f62a9bbd9740f94957175c21bb0b2f20c05696af 100644 (file)
@@ -344,7 +344,7 @@ static /*@null@*/struct commonio_entry *merge_group_entries (
                        members++;
                }
        }
-       new_members = CALLOC (members + 1, char *);
+       new_members = calloc_T(members + 1, char *);
        if (NULL == new_members) {
                free(new_line);
                return NULL;
index c1189f3cdb4674ded97f3d173c3da652a89c88b8..1ebe2f9ba002d265abfb34eda40a81df9a879bef 100644 (file)
@@ -25,7 +25,7 @@
        struct group *gr;
        int i;
 
-       gr = CALLOC(1, struct group);
+       gr = calloc_T(1, struct group);
        if (NULL == gr) {
                return NULL;
        }
index 485195bad7a69d71c93ba492cf8295e9ba551ebc..88a0c00e475780b5fe159ff77f07b4cf2adf82e5 100644 (file)
@@ -47,7 +47,7 @@ get_map_ranges(int ranges, int argc, char **argv)
                return NULL;
        }
 
-       mappings = CALLOC(ranges, struct map_range);
+       mappings = calloc_T(ranges, struct map_range);
        if (!mappings) {
                fprintf(log_get_logfd(), _( "%s: Memory allocation failure\n"),
                        log_get_progname());
index 411a5f154dd241ba2580f3200064941115403ff7..054077f392db9fe23e8c1ed0a326cd219a1f2f1d 100644 (file)
@@ -49,7 +49,7 @@ static int ni_conv (int num_msg,
                return PAM_CONV_ERR;
        }
 
-       responses = CALLOC (num_msg, struct pam_response);
+       responses = calloc_T(num_msg, struct pam_response);
        if (NULL == responses) {
                return PAM_CONV_ERR;
        }
index e0e0542f3f2aa292494274a9368220320665327d..b86be4b3a1e97d6d009c96ac7c0540953f3d9947 100644 (file)
@@ -25,7 +25,7 @@
 {
        struct passwd *pw;
 
-       pw = CALLOC (1, struct passwd);
+       pw = calloc_T(1, struct passwd);
        if (NULL == pw) {
                return NULL;
        }
index 09e6fbba0bb2a2567cfe5617c02c3262be3b18c9..ad3adc34634abe7056b01bfed2c5bd0066fd1a69 100644 (file)
@@ -34,7 +34,7 @@
        struct sgrp *sg;
        int i;
 
-       sg = CALLOC (1, struct sgrp);
+       sg = calloc_T(1, struct sgrp);
        if (NULL == sg) {
                return NULL;
        }
index bd2df3800f742dbdc337edf1982d6ab5af5780a0..1a7b9a2a755d500f7b8a0bad5c839e1ff86f7aba 100644 (file)
@@ -26,7 +26,7 @@
 {
        struct spwd *sp;
 
-       sp = CALLOC (1, struct spwd);
+       sp = calloc_T(1, struct spwd);
        if (NULL == sp) {
                return NULL;
        }