afs: casting NULL is generally unnecessary
authorChas Williams (CONTRACTOR) <chas@cmf.nrl.navy.mil>
Mon, 24 Sep 2012 19:06:10 +0000 (15:06 -0400)
committerDerrick Brashear <shadow@your-file-system.com>
Thu, 27 Sep 2012 18:03:07 +0000 (11:03 -0700)
Casting NULL shouldn't be necessary in most cases.  Eliminate this
in favor of shorter lines and consistency.  Function pointers, variadic
arguments should still be cast.

Change-Id: Ibcd67378556e45c2b24f7aa85a4d73c72cd88e02
Reviewed-on: http://gerrit.openafs.org/8151
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

39 files changed:
src/WINNT/afsd/cm_dnlc.c
src/WINNT/client_osi/osisleep.c
src/afs/DARWIN/osi_vnodeops.c
src/afs/IRIX/osi_inode.c
src/afs/IRIX/osi_misc.c
src/afs/IRIX/osi_vcache.c
src/afs/OBSD/osi_vnodeops.c
src/afs/SOLARIS/osi_inode.c
src/afs/afs_axscache.c
src/afs/afs_vcache.c
src/afsd/afsd.c
src/afsmonitor/afsmon-parselog.c
src/afsmonitor/afsmonitor.c
src/aklog/aklog.c
src/butc/tcmain.c
src/butc/tcudbprocs.c
src/comerr/compile_et.c
src/comerr/error_msg.c
src/comerr/error_table.y
src/comerr/error_table_nt.c
src/comerr/test/test.c
src/libafscp/afscp_util.c
src/lwp/lwp_nt.c
src/lwp/test/selclient.c
src/lwp/test/selserver.c
src/pam/afs_auth.c
src/pam/afs_session.c
src/pam/afs_setcred.c
src/ptserver/ptuser.c
src/rxgen/rpc_main.c
src/sgistuff/rcmd.c
src/sys/pioctl_nt.c
src/tsm41/aix_aklog.c
src/ubik/disk.c
src/ubik/ubik.c
src/uss/uss.c
src/util/fstab.c
src/venus/fs.c
src/vol/namei_ops.c

index ba36ba9..6425f12 100644 (file)
@@ -222,7 +222,7 @@ cm_dnlcLookup (cm_scache_t *adp, cm_lookupSearch_t* sp)
 
     ts = 0;
     tnc_begin = cm_data.nameHash[skey];
-    for ( tvc = (cm_scache_t *) NULL, tnc = tnc_begin, safety=0;
+    for ( tvc = NULL, tnc = tnc_begin, safety=0;
           tnc; tnc = tnc->next, safety++ )
     {
        if (tnc->dirp == adp)
index 5d6c4a2..57cf41d 100644 (file)
@@ -227,8 +227,8 @@ void osi_Init(void)
     /* initialize critical regions and semaphores */
     for(i=0;i<OSI_SLEEPHASHSIZE; i++) {
         InitializeCriticalSection(&osi_critSec[i]);
-        osi_sleepers[i] = (osi_sleepInfo_t *) NULL;
-        osi_sleepersEnd[i] = (osi_sleepInfo_t *) NULL;
+        osi_sleepers[i] = NULL;
+        osi_sleepersEnd[i] = NULL;
     }
 
     /* free list CS */
index 1d8a163..421215a 100644 (file)
@@ -159,7 +159,7 @@ struct vnodeopv_entry_desc afs_vnodeop_entries[] = {
     {VOPPREF(blktooff_desc), (VOPFUNC)afs_vop_blktooff},       /* blktooff */
     {VOPPREF(offtoblk_desc), (VOPFUNC)afs_vop_offtoblk},       /* offtoblk */
     {VOPPREF(bwrite_desc), (VOPFUNC)vn_bwrite},
-    {(struct vnodeop_desc *)NULL, (void (*)())NULL}
+    {NULL, (void (*)())NULL}
 };
 struct vnodeopv_desc afs_vnodeop_opv_desc =
     { &afs_vnodeop_p, afs_vnodeop_entries };
@@ -202,7 +202,7 @@ struct vnodeopv_entry_desc afs_dead_vnodeop_entries[] = {
     {VOPPREF(blktooff_desc), (VOPFUNC)err_blktooff},   /* blktooff */
     {VOPPREF(offtoblk_desc), (VOPFUNC)err_offtoblk},   /* offtoblk */
     {VOPPREF(bwrite_desc), (VOPFUNC)err_bwrite},
-    {(struct vnodeop_desc *)NULL, (void (*)())NULL}
+    {NULL, (void (*)())NULL}
 };
 struct vnodeopv_desc afs_dead_vnodeop_opv_desc =
     { &afs_dead_vnodeop_p, afs_dead_vnodeop_entries };
index 3c01cc0..011c4e0 100644 (file)
@@ -596,7 +596,7 @@ xfs_iincdec64(struct vfs *vfsp, ino_t inode, int inode_p1, int amount)
                    /* Try to remove the directory if this is a volume
                     * special file. It's ok to fail.
                     */
-                   AFS_VOP_LOOKUP(dvp, "..", &ddvp, (struct pathname *)NULL,
+                   AFS_VOP_LOOKUP(dvp, "..", &ddvp, NULL,
                                   0, OSI_GET_CURRENT_RDIR(),
                                   OSI_GET_CURRENT_CRED(), code2);
                    if (!code2) {
index 807e6d5..d2a18bf 100644 (file)
@@ -114,7 +114,7 @@ afs_init_kernel_config(int flag)
             * only if it's an IP27 or IP35.
             */
            pinv =
-               find_inventory((inventory_t *) NULL, INV_PROCESSOR,
+               find_inventory(NULL, INV_PROCESSOR,
                               INV_CPUBOARD, -1, -1, -1);
            if (!pinv)
                code = ENODEV;
index facda65..e273aa5 100644 (file)
@@ -95,7 +95,7 @@ osi_PostPopulateVCache(struct vcache *avc) {
     vSetVfsp(avc, afs_globalVFS);
     vSetType(avc, VREG);
 
-    VN_SET_DPAGES(&(avc->v), (struct pfdat *)NULL);
+    VN_SET_DPAGES(&(avc->v), NULL);
     osi_Assert((avc->v.v_flag & VINACT) == 0);
     avc->v.v_flag = 0;
     osi_Assert(VN_GET_PGCNT(&(avc->v)) == 0);
index 5035707..a3f572e 100644 (file)
@@ -197,7 +197,7 @@ struct vnodeopv_entry_desc afs_vnodeop_entries[] = {
     {&vop_advlock_desc, afs_obsd_advlock},     /* advlock */
     {&vop_reallocblks_desc, afs_obsd_reallocblks},     /* reallocblks */
     {&vop_bwrite_desc, vop_generic_bwrite},
-    {(struct vnodeop_desc *)NULL, (int (*)__P((void *)))NULL}
+    {NULL, (int (*)__P((void *)))NULL}
 };
 struct vnodeopv_desc afs_vnodeop_opv_desc =
     { &afs_vnodeop_p, afs_vnodeop_entries };
index 42c3541..2852eee 100644 (file)
@@ -258,7 +258,7 @@ afs_syscall_iopen(dev, inode, usrmod, rvp, credp)
     if (code) {
        return (code);
     }
-    code = falloc((struct vnode *)NULL, FWRITE | FREAD, &fp, &fd);
+    code = falloc(NULL, FWRITE | FREAD, &fp, &fd);
     if (code) {
        rw_enter(&ip->i_contents, RW_READER);
        AFS_ITIMES(ip);
index 08f233a..bff5555 100644 (file)
@@ -48,10 +48,10 @@ afs_SlowFindAxs(struct axscache **cachep, afs_int32 id)
                return (j);
            }
        } else
-           return ((struct axscache *)NULL);
+           return (NULL);
        i = j->next;
     }
-    return ((struct axscache *)NULL);
+    return (NULL);
 }
 
 
index 350ba78..3e48723 100644 (file)
@@ -172,7 +172,7 @@ afs_FlushVCache(struct vcache *avc, int *slept)
     for (wvc = *uvc; wvc; uvc = &wvc->hnext, wvc = *uvc) {
        if (avc == wvc) {
            *uvc = avc->hnext;
-           avc->hnext = (struct vcache *)NULL;
+           avc->hnext = NULL;
            break;
        }
     }
index 4fb0758..817d98c 100644 (file)
@@ -1335,7 +1335,7 @@ CheckCacheBaseDir(char *dir)
 
                    if (cp = hasmntopt(&mnt, "dev="))
                        rdev =
-                           (int)strtol(cp + strlen("dev="), (char **)NULL,
+                           (int)strtol(cp + strlen("dev="), NULL,
                                        16);
 
                    if ((rdev == 0) && (stat(mnt.mnt_mountp, &statmnt) == 0))
index faf7fd8..fee721d 100644 (file)
@@ -734,13 +734,13 @@ main(argc, argv)
     /* Malloc two blocks of data, one for reading each line from the data file
      * and the other for coverting data to longs */
 
-    if ((line = malloc(block_size + 256)) == (char *)NULL) {
+    if ((line = malloc(block_size + 256)) == NULL) {
        fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn,
                block_size + 256);
        exit(10);
     }
 
-    if ((longs = malloc(block_size)) == (long *)NULL) {
+    if ((longs = malloc(block_size)) == NULL) {
        fprintf(stderr, "[ %s ] malloc %d bytes failed\n", rn, block_size);
        exit(20);
     }
index 0ad6d71..288a519 100644 (file)
@@ -299,7 +299,7 @@ strcasestr(s1, s2)
     len2 = strlen(s2);
 
     if (len1 < len2)
-       return ((char *)NULL);
+       return (NULL);
 
     ptr = s1;
 
@@ -309,7 +309,7 @@ strcasestr(s1, s2)
        ptr++;
        len1--;
     }
-    return ((char *)NULL);
+    return (NULL);
 }
 #endif
 
@@ -1158,8 +1158,8 @@ parse_showEntry(char *a_line)
        /* if it is a section/group name, find it in the fs_categories[] array */
 
        found = 0;
-       if (strcasestr(arg2, "_section") != (char *)NULL
-           || strcasestr(arg2, "_group") != (char *)NULL) {
+       if (strcasestr(arg2, "_section") != NULL
+           || strcasestr(arg2, "_group") != NULL) {
            idx = 0;
            while (idx < FS_NUM_DATA_CATEGORIES) {
                sscanf(fs_categories[idx], "%s %d %d", catName, &fromIdx,
@@ -1182,7 +1182,7 @@ parse_showEntry(char *a_line)
        /* if it is a group name, read its start/end indices and fill in the
         * fs_Display_map[]. */
 
-       if (strcasestr(arg2, "_group") != (char *)NULL) {
+       if (strcasestr(arg2, "_group") != NULL) {
 
            if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_FS_STAT_ENTRIES
                || toIdx > NUM_FS_STAT_ENTRIES)
@@ -1202,7 +1202,7 @@ parse_showEntry(char *a_line)
            /* if it is a section name, get the count of number of groups in it and
             * for each group fill in the start/end indices in the fs_Display_map[] */
 
-       if (strcasestr(arg2, "_section") != (char *)NULL) {
+       if (strcasestr(arg2, "_section") != NULL) {
            /* fromIdx is actually the number of groups in thi section */
            numGroups = fromIdx;
            /* for each group in section */
@@ -1273,8 +1273,8 @@ parse_showEntry(char *a_line)
        /* if it is a section/group name, find it in the cm_categories[] array */
 
        found = 0;
-       if (strcasestr(arg2, "_section") != (char *)NULL
-           || strcasestr(arg2, "_group") != (char *)NULL) {
+       if (strcasestr(arg2, "_section") != NULL
+           || strcasestr(arg2, "_group") != NULL) {
            idx = 0;
            while (idx < CM_NUM_DATA_CATEGORIES) {
                sscanf(cm_categories[idx], "%s %d %d", catName, &fromIdx,
@@ -1297,7 +1297,7 @@ parse_showEntry(char *a_line)
        /* if it is a group name, read its start/end indices and fill in the
         * cm_Display_map[]. */
 
-       if (strcasestr(arg2, "_group") != (char *)NULL) {
+       if (strcasestr(arg2, "_group") != NULL) {
 
            if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_CM_STAT_ENTRIES
                || toIdx > NUM_CM_STAT_ENTRIES)
@@ -1317,7 +1317,7 @@ parse_showEntry(char *a_line)
            /* if it is a section name, get the count of number of groups in it and
             * for each group fill in the start/end indices in the cm_Display_map[] */
 
-       if (strcasestr(arg2, "_section") != (char *)NULL) {
+       if (strcasestr(arg2, "_section") != NULL) {
            /* fromIdx is actually the number of groups in thi section */
            numGroups = fromIdx;
            /* for each group in section */
index ce64768..687a3c1 100644 (file)
@@ -2091,8 +2091,8 @@ get_credv5(krb5_context context, char *name, char *inst, char *realm,
     if ((r = krb5_build_principal(context, &increds.server,
                                  strlen(realm), realm,
                                  name,
-                                 (inst && strlen(inst)) ? inst : (void *) NULL,
-                                 (void *) NULL))) {
+                                 (inst && strlen(inst)) ? inst : NULL,
+                                 NULL))) {
         return r;
     }
 
index 3bf6f2d..ada5099 100644 (file)
@@ -1226,10 +1226,10 @@ main(int argc, char **argv)
        ti->next = 0;
        ti->data = "0";
        ts->parms[1].items = ti;
-       ts->parms[2].items = (struct cmd_item *)NULL;
-       ts->parms[3].items = (struct cmd_item *)NULL;
-       ts->parms[4].items = (struct cmd_item *)NULL;
-       ts->parms[5].items = (struct cmd_item *)NULL;
+       ts->parms[2].items = NULL;
+       ts->parms[3].items = NULL;
+       ts->parms[4].items = NULL;
+       ts->parms[5].items = NULL;
        return WorkerBee(ts, NULL);
     } else
        return cmd_Dispatch(argc, argv);
index 386360a..5bb0ca1 100644 (file)
@@ -490,7 +490,7 @@ writeDbDump(struct butm_tapeInfo *tapeInfoPtr, afs_uint32 taskId,
                AFS_SIGSET_RESTORE();
 #else
                code =
-                   LWP_CreateProcess(KeepAlive, 16384, 1, (void *)NULL,
+                   LWP_CreateProcess(KeepAlive, 16384, 1, NULL,
                                      "Keep-alive process", &alivePid);
 #endif
                /* XXX should we check code here ??? XXX */
index 808c92b..560cc1b 100644 (file)
@@ -26,7 +26,7 @@ static const char copyright[] =
 extern char *current_token;
 extern int table_number, current;
 char buffer[BUFSIZ];
-char *table_name = (char *)NULL;
+char *table_name = NULL;
 FILE *hfile, *cfile, *msfile;
 int version = 1;
 int use_msf = 0;
@@ -240,7 +240,7 @@ main(int argc, char **argv)
 
 
     p = strrchr(filename, '/');
-    if (p == (char *)NULL)
+    if (p == NULL)
        p = filename;
     else
        p++;
@@ -285,7 +285,7 @@ main(int argc, char **argv)
     }
 
     hfile = fopen(h_file, "w");
-    if (hfile == (FILE *) NULL) {
+    if (hfile == NULL) {
        perror(h_file);
        exit(1);
     }
@@ -326,14 +326,14 @@ main(int argc, char **argv)
 
     if (use_msf) {
        msfile = fopen(msf_file, "w");
-       if (msfile == (FILE *) NULL) {
+       if (msfile == NULL) {
            perror(msf_file);
            exit(1);
        }
        fprintf(msfile, msf_warning, msf_file);
     } else {
        cfile = fopen(c_file, "w");
-       if (cfile == (FILE *) NULL) {
+       if (cfile == NULL) {
            perror(c_file);
            exit(1);
        }
index 413a2e9..c5f6d02 100644 (file)
@@ -33,7 +33,7 @@ static const char copyright[] =
 
 static char buffer[64];
 
-static struct et_list *_et_list = (struct et_list *)NULL;
+static struct et_list *_et_list = NULL;
 
 #ifdef AFS_PTHREAD_ENV
 #include <pthread.h>
index db5692a..d143fd4 100644 (file)
@@ -46,7 +46,7 @@
 
 int char_to_num(char c);
 char *gensym(const char *x);
-char *current_token = (char *)NULL;
+char *current_token = NULL;
 extern char *table_name;
 
 char *quote(const char *string);
@@ -171,7 +171,7 @@ quote(const char *string)
 
 afs_int32 table_number = 0;
 int current = 0;
-char **error_codes = (char **)NULL;
+char **error_codes = NULL;
 
 void add_ec(const char *name, const char *description)
 {
@@ -185,14 +185,14 @@ void add_ec(const char *name, const char *description)
         } else {
            fprintf(cfile, "\t\"%s\",\n", description);
        }
-       if (error_codes == (char **)NULL) {
+       if (error_codes == NULL) {
                error_codes = malloc(sizeof(char *));
-               *error_codes = (char *)NULL;
+               *error_codes = NULL;
        }
        error_codes = (char **)realloc((char *)error_codes,
                                       (current + 2)*sizeof(char *));
        error_codes[current++] = strdup(name);
-       error_codes[current] = (char *)NULL;
+       error_codes[current] = NULL;
 }
 
 void add_ec_val(const char *name, const char *val, const char *description)
@@ -206,7 +206,7 @@ void add_ec_val(const char *name, const char *val, const char *description)
       
        while (ncurrent > current) {
             if (!msfile)
-                fputs("\t(char *)NULL,\n", cfile);
+                fputs("\tNULL,\n", cfile);
             current++;
         }
         if (msfile) {
@@ -219,21 +219,21 @@ void add_ec_val(const char *name, const char *val, const char *description)
         } else {       
            fprintf(cfile, "\t\"%s\",\n", description);
        }
-       if (error_codes == (char **)NULL) {
+       if (error_codes == NULL) {
                error_codes = malloc(sizeof(char *));
-               *error_codes = (char *)NULL;
+               *error_codes = NULL;
        }
        error_codes = (char **)realloc((char *)error_codes,
                                       (current + 2)*sizeof(char *));
        error_codes[current++] = strdup(name);
-       error_codes[current] = (char *)NULL;
+       error_codes[current] = NULL;
 } 
 
 void put_ecs(void)
 {
        int i;
        for (i = 0; i < current; i++) {
-            if (error_codes[i] != (char *)NULL)
+            if (error_codes[i] != NULL)
                  fprintf(hfile, "#define %-40s (%ldL)\n",
                          error_codes[i], (long int) table_number + i);
        }
index 1d85279..f5ea2b2 100755 (executable)
@@ -34,7 +34,7 @@
 
 #include "internal.h"
 
-char *current_token = (char *)NULL;
+char *current_token = NULL;
 extern char *table_name;
 
 char *quote(const char *string);
@@ -987,7 +987,7 @@ quote(const char *string)
 
 afs_int32 table_number = 0;
 int current = 0;
-char **error_codes = (char **)NULL;
+char **error_codes = NULL;
 
 void
 add_ec(const char *name, const char *description)
@@ -1002,13 +1002,13 @@ add_ec(const char *name, const char *description)
     } else {
        fprintf(cfile, "\t\"%s\",\n", description);
     }
-    if (error_codes == (char **)NULL) {
+    if (error_codes == NULL) {
        error_codes = malloc(sizeof(char *));
-       *error_codes = (char *)NULL;
+       *error_codes = NULL;
     }
     error_codes = realloc(error_codes, (current + 2) * sizeof(char *));
     error_codes[current++] = strdup(name);
-    error_codes[current] = (char *)NULL;
+    error_codes[current] = NULL;
 }
 
 void
@@ -1022,7 +1022,7 @@ add_ec_val(const char *name, const char *val, const char *description)
 
     while (ncurrent > current) {
        if (!msfile)
-           fputs("\t(char *)NULL,\n", cfile);
+           fputs("\tNULL,\n", cfile);
        current++;
     }
     if (msfile) {
@@ -1035,13 +1035,13 @@ add_ec_val(const char *name, const char *val, const char *description)
     } else {
        fprintf(cfile, "\t\"%s\",\n", description);
     }
-    if (error_codes == (char **)NULL) {
+    if (error_codes == NULL) {
        error_codes = malloc(sizeof(char *));
-       *error_codes = (char *)NULL;
+       *error_codes = NULL;
     }
     error_codes = realloc(error_codes, (current + 2) * sizeof(char *));
     error_codes[current++] = strdup(name);
-    error_codes[current] = (char *)NULL;
+    error_codes[current] = NULL;
 }
 
 void
@@ -1049,7 +1049,7 @@ put_ecs(void)
 {
     int i;
     for (i = 0; i < current; i++) {
-       if (error_codes[i] != (char *)NULL)
+       if (error_codes[i] != NULL)
            fprintf(hfile, "#define %-40s (%ldL)\n", error_codes[i],
                    table_number + i);
     }
index 2babc5f..885315f 100644 (file)
@@ -44,7 +44,7 @@ main()
     printf("Msg KRB_SKDC_CANT is '%s'\n", afs_error_message(KRB_SKDC_CANT));
     printf("Msg 1e6 (8B 64) is '%s'\n", afs_error_message(1000000));
     printf("\n\nCOM_ERR tests:\n");
-    afs_com_err("whoami", FOO_ERR, (char *)NULL);
+    afs_com_err("whoami", FOO_ERR, NULL);
     afs_com_err("whoami", FOO_ERR, " -- message goes %s", "here");
     afs_com_err("whoami", 0, NULL);
     afs_com_err("whoami", 0, "error number %d\n", 0);
index d14f5b8..0e9e3aa 100644 (file)
@@ -295,7 +295,7 @@ _GetSecurityObject(struct afscp_cell *cell)
        match.server = NULL;
 
        code = krb5_build_principal(context, &match.server,
-                                   strlen(realm), realm, "afs", (void *)NULL);
+                                   strlen(realm), realm, "afs", NULL);
        if (code == 0)
            code = krb5_get_credentials(context, 0, cc, &match, &cred);
        if (code != 0) {
index 8fc5a35..b7ee4e9 100644 (file)
@@ -491,7 +491,7 @@ static void Initialize_PCB(PROCESS pcb, int priority, int stacksize,
     pcb->wakevent = 0;
     pcb->waitcnt = 0;
     pcb->next = pcb->prev = (PROCESS)NULL;
-    pcb->iomgrRequest = (struct IoRequest*)NULL;
+    pcb->iomgrRequest = NULL;
     pcb->index = lwp_nextindex ++;
 }
 
index 8520680..f8479d8 100644 (file)
@@ -285,7 +285,7 @@ sendTest(int sockFD, int delay, int reqOOB, int size)
            (void)time(&stime);
            code =
                IOMGR_Select(sockFD + 1, rfds, wfds, efds,
-                            (struct timeval *)NULL);
+                            NULL);
            assert(code > 0);
 
            if (FD_ISSET(sockFD, wfds)) {
index 1215852..a459ba9 100644 (file)
@@ -96,7 +96,7 @@ getClientHandle()
     }
     Die(1, "No free client handles!\n");
 
-    return (clientHandle_t *) NULL;    /* quiet compiler. */
+    return NULL;       /* quiet compiler. */
 }
 
 int nSigIO = 0;
@@ -299,7 +299,7 @@ handleRequest(char *arg)
        FD_SET(ch->ch_fd, &(ch->ch_except));
        code =
            IOMGR_Select(ch->ch_fd + 1, &(ch->ch_read), &(ch->ch_write),
-                        &(ch->ch_except), (struct timeval *)NULL);
+                        &(ch->ch_except), NULL);
        if (FD_ISSET(ch->ch_fd, &(ch->ch_except))) {
            Log("Received expception. Read fd_set shows %d\n",
                FD_ISSET(ch->ch_fd, &(ch->ch_read)));
index cdeeb0e..d41d2f0 100644 (file)
@@ -101,7 +101,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,
                ignore_uid = 0;
            } else {
                ignore_uid = 1;
-               ignore_uid_id = (uid_t) strtol(argv[i], (char **)NULL, 10);
+               ignore_uid_id = (uid_t) strtol(argv[i], NULL, 10);
                if (ignore_uid_id > IGNORE_MAX) {
                    ignore_uid = 0;
                    pam_afs_syslog(LOG_ERR, PAMAFS_IGNOREUID, argv[i]);
index 4ff997d..e4a3620 100644 (file)
@@ -54,7 +54,7 @@ pam_sm_close_session(pam_handle_t * pamh, int flags, int argc,
        } else if (strcasecmp(argv[i], "remainlifetime") == 0) {
            i++;
            remain = 1;
-           remainlifetime = (int)strtol(argv[i], (char **)NULL, 10);
+           remainlifetime = (int)strtol(argv[i], NULL, 10);
            if (remainlifetime == 0) {
                if ((errno == EINVAL) || (errno == ERANGE)) {
                    remainlifetime = REMAINLIFETIME;
index e52d988..0bfbb85 100644 (file)
@@ -91,7 +91,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv)
                ignore_uid = 0;
            } else {
                ignore_uid = 1;
-               ignore_uid_id = (uid_t) strtol(argv[i], (char **)NULL, 10);
+               ignore_uid_id = (uid_t) strtol(argv[i], NULL, 10);
                if (ignore_uid_id > IGNORE_MAX) {
                    ignore_uid = 0;
                    pam_afs_syslog(LOG_ERR, PAMAFS_IGNOREUID, argv[i]);
index 33e4e4a..1505402 100644 (file)
@@ -181,7 +181,7 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell)
     afs_int32 code;
     struct rx_connection *serverconns[MAXSERVERS];
     struct rx_securityClass *sc = NULL;
-    static struct afsconf_dir *tdir = (struct afsconf_dir *)NULL;      /* only do this once */
+    static struct afsconf_dir *tdir = NULL;    /* only do this once */
     static char tconfDir[100] = "";
     static char tcell[64] = "";
     afs_int32 scIndex;
@@ -237,9 +237,9 @@ pr_Initialize(IN afs_int32 secLevel, IN const char *confDir, IN char *cell)
         */
        if (tdir && !gottdir) {
            afsconf_Close(tdir);
-            tdir = (struct afsconf_dir *)NULL;
+            tdir = NULL;
         }
-       pruclient = (struct ubik_client *)NULL;
+       pruclient = NULL;
         refresh = 1;
     }
 
index 790d0e2..d0e167a 100644 (file)
@@ -582,7 +582,7 @@ s_output(int argc, char *argv[], char *infile, char *define, int extend,
        return;
     }
     if (nomain) {
-       write_programs((char *)NULL);
+       write_programs(NULL);
     } else {
        write_most();
        do_registers(argc, argv);
index da63272..6e471da 100644 (file)
@@ -586,7 +586,7 @@ _checkhost(rhost, lhost, len)
            return (0);
        }
        ldomain[MAXHOSTNAMELEN] = '\0';
-       if ((domainp = strchr(ldomain, '.')) == (char *)NULL) {
+       if ((domainp = strchr(ldomain, '.')) == NULL) {
            nodomain = 1;
            return (0);
        }
index 7654fc5..2d51ebb 100644 (file)
@@ -172,7 +172,7 @@ RDR_Ready(void)
                                MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
                                buf,
                                4096,
-                               (va_list *) NULL
+                               NULL
                                ) )
             {
                 fprintf(stderr,"RDR_Ready CreateFile(%S) failed: 0x%X\r\n\t[%s]\r\n",
@@ -215,7 +215,7 @@ RDR_Ready(void)
                                     MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
                                     buf,
                                     4096,
-                                    (va_list *) NULL
+                                    NULL
                                     ) )
                 {
                     fprintf(stderr,"RDR_Ready CreateFile(%s) failed: 0x%X\r\n\t[%s]\r\n",
@@ -846,7 +846,7 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                                MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
                                buf,
                                4096,
-                               (va_list *) NULL
+                               NULL
                                ) )
             {
                 fprintf(stderr,"pioctl GetFileAttributes(%s) failed: 0x%X\r\n\t[%s]\r\n",
@@ -921,7 +921,7 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                                         MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
                                         buf,
                                         4096,
-                                        (va_list *) NULL
+                                        NULL
                                         ) )
                     {
                         fprintf(stderr,"pioctl GetFileAttributes(%s) failed: 0x%X\r\n\t[%s]\r\n",
@@ -990,7 +990,7 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                                         MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
                                         buf,
                                         4096,
-                                        (va_list *) NULL
+                                        NULL
                                         ) )
                     {
                         fprintf(stderr,"pioctl GetFileAttributes(%s) failed: 0x%X\r\n\t[%s]\r\n",
@@ -1053,7 +1053,7 @@ GetIoctlHandle(char *fileNamep, HANDLE * handlep)
                                         MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),
                                         buf,
                                         4096,
-                                        (va_list *) NULL
+                                        NULL
                                         ) )
                     {
                         fprintf(stderr,"pioctl GetFileAttributes(%s) failed: 0x%X\r\n\t[%s]\r\n",
index a450a9f..49d677a 100644 (file)
@@ -230,8 +230,8 @@ get_credv5(krb5_context context, char *user,
     if ((r = krb5_build_principal(context, &increds.server,
                                  strlen(realm), realm,
                                  name,
-                                 (inst && strlen(inst)) ? inst : (void *) NULL,
-                                 (void *) NULL))) {
+                                 (inst && strlen(inst)) ? inst : NULL,
+                                 NULL))) {
         return r;
     }
     r = krb5_cc_default(context, &_krb425_ccache);
index e9c81e6..2cff7ff 100644 (file)
@@ -829,7 +829,7 @@ udisk_begin(struct ubik_dbase *adbase, int atype, struct ubik_trans **atrans)
     afs_int32 code;
     struct ubik_trans *tt;
 
-    *atrans = (struct ubik_trans *)NULL;
+    *atrans = NULL;
     if (atype == UBIK_WRITETRANS) {
        if (adbase->flags & DBWRITING)
            return USYNC;
index 0c3cc2d..b42bf4c 100644 (file)
@@ -641,7 +641,7 @@ BeginTrans(struct ubik_dbase *dbase, afs_int32 transMode,
     /* create the transaction */
     code = udisk_begin(dbase, transMode, &jt); /* can't take address of register var */
     tt = jt;                   /* move to a register */
-    if (code || tt == (struct ubik_trans *)NULL) {
+    if (code || tt == NULL) {
        DBRELE(dbase);
        return code;
     }
index c3394bc..c9afaf5 100644 (file)
@@ -1803,7 +1803,7 @@ main(int argc, char *argv[])
     sigaction(SIGSEGV, &nsa, NULL);
 #endif
     strcpy(uss_whoami, argv[0]);
-    yyin = (FILE *) NULL;
+    yyin = NULL;
 
     uss_fs_InBuff = malloc(USS_FS_MAX_SIZE);   /*Cache Manager input buff */
     uss_fs_OutBuff = malloc(USS_FS_MAX_SIZE);  /*Cache Manager output buff */
index 439c695..1606d4b 100644 (file)
@@ -58,7 +58,7 @@ mntinfo(struct statfs **mntbuffer)
     return (mntsize);
 }
 
-static struct statfs *mntbuf = (struct statfs *)NULL;
+static struct statfs *mntbuf = NULL;
 static struct statfs *mntent;
 static int mntcnt;
 static struct fstab fstabent;
@@ -67,7 +67,7 @@ struct fstab *
 getfsent(void)
 {
     if (((!mntbuf) && !setfsent()) || mntcnt == 0)
-       return ((struct fstab *)NULL);
+       return (NULL);
     fstabent.fs_file = mntent->f_mntonname;
     fstabent.fs_freq = fstabent.fs_passno = 0;
     fstabent.fs_mntops = mntent->f_fstypename;
index 382d3cd..9dc26ba 100644 (file)
@@ -296,7 +296,7 @@ Parent(char *apath)
     tp = strrchr(tspace, '/');
     if (tp == (char *)tspace)
        tp++;
-    else if (tp == (char *)NULL) {
+    else if (tp == NULL) {
        tp      = (char *)tspace;
        *(tp++) = '.';
     }
index 3f765ac..69873fe 100644 (file)
@@ -449,7 +449,7 @@ delTree(char *root, char *tree, int *errp)
            cp = tree + strlen(tree);   /* move cp to the end of string tree */
 
        /* now delete all entries in this dir */
-       if ((ds = opendir(root)) != (DIR *) NULL) {
+       if ((ds = opendir(root)) != NULL) {
            errno = 0;
            while ((dirp = readdir(ds))) {
                /* ignore . and .. */