ptserver/testpt.c: remove dead code in ListUsedIds
[openafs.git] / src / ptserver / testpt.c
index 1b28245..8ddf429 100644 (file)
@@ -11,6 +11,7 @@
 #include <afs/param.h>
 
 #include <roken.h>
+#include <afs/opr.h>
 
 #include <ctype.h>
 #include <math.h>
@@ -86,8 +87,6 @@ ListUsedIds(struct cmd_syndesc *as, void *arock)
        }
     }
     range = abs(startId - maxId);
-    if (range < 0)
-       range = -range;
     range++;                   /* number that can be printed */
     if (range < number) {
        fprintf(stderr, "Only %d ids to be checked.\n", range);
@@ -97,7 +96,7 @@ ListUsedIds(struct cmd_syndesc *as, void *arock)
     printf("Checking for %d %sused ids starting at %d.\n", number,
           (unused ? "un" : ""), startId);
 #define NUM 100
-    lids.idlist_val = (afs_int32 *) malloc(sizeof(afs_int32) * NUM);
+    lids.idlist_val = malloc(sizeof(afs_int32) * NUM);
     lnames.namelist_len = 0;
     lnames.namelist_val = 0;
     while (number) {
@@ -488,22 +487,17 @@ TestManyMembers(struct cmd_syndesc *as, void *arock)
 
     srandom(seed);
 
-    users = (afs_int32 *) malloc(number * sizeof(afs_int32));
-    groups = (afs_int32 *) malloc(number * sizeof(afs_int32));
-    filled = (char *)malloc(number * sizeof(char));
-    cleaned = (char *)malloc(number * sizeof(char));
-    population = (char *)malloc(sqr(number) * sizeof(char));
+    users = calloc(number, sizeof(afs_int32));
+    groups = calloc(number, sizeof(afs_int32));
+    filled = calloc(number, sizeof(char));
+    cleaned = calloc(number, sizeof(char));
+    population = calloc(sqr(number), sizeof(char));
 
     nFilled = 0;
-    memset(filled, 0, number);
     nCleaned = 0;
-    memset(cleaned, 0, number);
-    memset(population, 0, sqr(number));
-    memset(users, 0, number * sizeof(afs_int32));
-    memset(groups, 0, number * sizeof(afs_int32));
 
     ownerUser = lastGroup = 0;
-    groupOwners = (afs_int32 *) malloc(number * sizeof(afs_int32));
+    groupOwners = malloc(number * sizeof(afs_int32));
     nUsers = nGroups = nAdds = nRems = nUDels = nGDels = 0;
 
     while ((nFilled < number) || (nCleaned < number)) {
@@ -562,7 +556,7 @@ TestManyMembers(struct cmd_syndesc *as, void *arock)
 
     /* check the membership list of all users for correctness */
     printf("Starting check of memberships\n");
-    glist = (afs_int32 *) malloc(number * sizeof(afs_int32));
+    glist = malloc(number * sizeof(afs_int32));
     for (u = 0; u < number; u++) {
        afs_int32 ui = users[u];
        if (ui) {
@@ -992,7 +986,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
        }
 
        strcompose(tmp_conf_file, 128, tmp_conf_dir, "/",
-                  AFSDIR_CELLSERVDB_FILE, NULL);
+                  AFSDIR_CELLSERVDB_FILE, (char *)NULL);
        f = fopen(tmp_conf_file, "w");
        if (f == 0) {
          cantcreate:
@@ -1015,7 +1009,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
        }
 
        strcompose(tmp_cell_file, 128, tmp_conf_dir, "/",
-                  AFSDIR_THISCELL_FILE, NULL);
+                  AFSDIR_THISCELL_FILE, (char *)NULL);
        f = fopen(tmp_cell_file, "w");
        if (f == 0)
            goto cantcreate;
@@ -1024,7 +1018,7 @@ MyBeforeProc(struct cmd_syndesc *as, void *arock)
            goto cantclose;
 
        strcompose(tmp_noauth_file, 128, tmp_conf_dir, "/",
-                  AFSDIR_NOAUTH_FILE, NULL);
+                  AFSDIR_NOAUTH_FILE, (char *)NULL);
        if (noAuth) {
            code = creat(tmp_noauth_file, 0777);
            if (code && (errno != EEXIST))