diff options
-rw-r--r-- | bin/pax/ar_io.c | 4 | ||||
-rw-r--r-- | bin/pax/cache.c | 14 | ||||
-rw-r--r-- | bin/pax/ftree.c | 4 | ||||
-rw-r--r-- | bin/pax/options.c | 4 | ||||
-rw-r--r-- | bin/pax/pat_rep.c | 14 | ||||
-rw-r--r-- | bin/pax/sel_subs.c | 20 | ||||
-rw-r--r-- | bin/pax/tables.c | 54 |
7 files changed, 57 insertions, 57 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index 94873514adf..5cc5775b1bb 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_io.c,v 1.47 2014/05/23 21:58:26 guenther Exp $ */ +/* $OpenBSD: ar_io.c,v 1.48 2014/05/24 18:51:00 guenther Exp $ */ /* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */ /*- @@ -1217,7 +1217,7 @@ ar_next(void) */ if (ar_open(buf) >= 0) { if (freeit) { - (void)free((char *)arcname); + free((char *)arcname); freeit = 0; } if ((arcname = strdup(buf)) == NULL) { diff --git a/bin/pax/cache.c b/bin/pax/cache.c index 3673ebb885f..a0d38cb6612 100644 --- a/bin/pax/cache.c +++ b/bin/pax/cache.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cache.c,v 1.20 2012/12/04 02:24:45 deraadt Exp $ */ +/* $OpenBSD: cache.c,v 1.21 2014/05/24 18:51:00 guenther Exp $ */ /* $NetBSD: cache.c,v 1.4 1995/03/21 09:07:10 cgd Exp $ */ /*- @@ -77,7 +77,7 @@ uidtb_start(void) return(0); if (fail) return(-1); - if ((uidtb = (UIDC **)calloc(UID_SZ, sizeof(UIDC *))) == NULL) { + if ((uidtb = calloc(UID_SZ, sizeof(UIDC *))) == NULL) { ++fail; paxwarn(1, "Unable to allocate memory for user id cache table"); return(-1); @@ -101,7 +101,7 @@ gidtb_start(void) return(0); if (fail) return(-1); - if ((gidtb = (GIDC **)calloc(GID_SZ, sizeof(GIDC *))) == NULL) { + if ((gidtb = calloc(GID_SZ, sizeof(GIDC *))) == NULL) { ++fail; paxwarn(1, "Unable to allocate memory for group id cache table"); return(-1); @@ -125,7 +125,7 @@ usrtb_start(void) return(0); if (fail) return(-1); - if ((usrtb = (UIDC **)calloc(UNM_SZ, sizeof(UIDC *))) == NULL) { + if ((usrtb = calloc(UNM_SZ, sizeof(UIDC *))) == NULL) { ++fail; paxwarn(1, "Unable to allocate memory for user name cache table"); return(-1); @@ -149,7 +149,7 @@ grptb_start(void) return(0); if (fail) return(-1); - if ((grptb = (GIDC **)calloc(GNM_SZ, sizeof(GIDC *))) == NULL) { + if ((grptb = calloc(GNM_SZ, sizeof(GIDC *))) == NULL) { ++fail; paxwarn(1,"Unable to allocate memory for group name cache table"); return(-1); @@ -330,7 +330,7 @@ uid_name(char *name, uid_t *uid) if (ptr == NULL) ptr = usrtb[st_hash(name, namelen, UNM_SZ)] = - (UIDC *)malloc(sizeof(UIDC)); + malloc(sizeof(UIDC)); /* * no match, look it up, if no match store it as an invalid entry, @@ -392,7 +392,7 @@ gid_name(char *name, gid_t *gid) } if (ptr == NULL) ptr = grptb[st_hash(name, namelen, GID_SZ)] = - (GIDC *)malloc(sizeof(GIDC)); + malloc(sizeof(GIDC)); /* * no match, look it up, if no match store it as an invalid entry, diff --git a/bin/pax/ftree.c b/bin/pax/ftree.c index 969d92657f0..0d02f8e373f 100644 --- a/bin/pax/ftree.c +++ b/bin/pax/ftree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftree.c,v 1.30 2012/12/04 02:24:45 deraadt Exp $ */ +/* $OpenBSD: ftree.c,v 1.31 2014/05/24 18:51:00 guenther Exp $ */ /* $NetBSD: ftree.c,v 1.4 1995/03/21 09:07:21 cgd Exp $ */ /*- @@ -152,7 +152,7 @@ ftree_add(char *str, int chflg) * processed in the same order they were passed to pax). Get rid of any * trailing / the user may pass us. (watch out for / by itself). */ - if ((ft = (FTREE *)malloc(sizeof(FTREE))) == NULL) { + if ((ft = malloc(sizeof(FTREE))) == NULL) { paxwarn(0, "Unable to allocate memory for filename"); return(-1); } diff --git a/bin/pax/options.c b/bin/pax/options.c index 85649da0ebd..62c3b0dd1fb 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.85 2014/05/07 14:56:57 tedu Exp $ */ +/* $OpenBSD: options.c,v 1.86 2014/05/24 18:51:00 guenther Exp $ */ /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ /*- @@ -1422,7 +1422,7 @@ opt_add(const char *str) free(dstr); return(-1); } - if ((opt = (OPLIST *)malloc(sizeof(OPLIST))) == NULL) { + if ((opt = malloc(sizeof(OPLIST))) == NULL) { paxwarn(0, "Unable to allocate space for option list"); free(dstr); return(-1); diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c index 6e6d782681f..a78109065c8 100644 --- a/bin/pax/pat_rep.c +++ b/bin/pax/pat_rep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pat_rep.c,v 1.33 2014/01/08 04:42:24 guenther Exp $ */ +/* $OpenBSD: pat_rep.c,v 1.34 2014/05/24 18:51:00 guenther Exp $ */ /* $NetBSD: pat_rep.c,v 1.4 1995/03/21 09:07:33 cgd Exp $ */ /*- @@ -121,7 +121,7 @@ rep_add(char *str) * allocate space for the node that handles this replacement pattern * and split out the regular expression and try to compile it */ - if ((rep = (REPLACE *)malloc(sizeof(REPLACE))) == NULL) { + if ((rep = malloc(sizeof(REPLACE))) == NULL) { paxwarn(1, "Unable to allocate memory for replacement string"); return(-1); } @@ -130,7 +130,7 @@ rep_add(char *str) if ((res = regcomp(&(rep->rcmp), str+1, 0)) != 0) { regerror(res, &(rep->rcmp), rebuf, sizeof(rebuf)); paxwarn(1, "%s while compiling regular expression %s", rebuf, str); - (void)free((char *)rep); + free(rep); return(-1); } @@ -150,7 +150,7 @@ rep_add(char *str) } if (*pt2 == '\0') { regfree(&(rep->rcmp)); - (void)free((char *)rep); + free(rep); paxwarn(1, "Invalid replacement string %s", str); return(-1); } @@ -175,7 +175,7 @@ rep_add(char *str) break; default: regfree(&(rep->rcmp)); - (void)free((char *)rep); + free(rep); *pt1 = *str; paxwarn(1, "Invalid replacement string option %s", str); return(-1); @@ -225,7 +225,7 @@ pat_add(char *str, char *chdirname) * part of argv so do not bother to copy it, just point at it. Add the * node to the end of the pattern list */ - if ((pt = (PATTERN *)malloc(sizeof(PATTERN))) == NULL) { + if ((pt = malloc(sizeof(PATTERN))) == NULL) { paxwarn(1, "Unable to allocate memory for pattern string"); return(-1); } @@ -391,7 +391,7 @@ pat_sel(ARCHD *arcn) return(-1); } *ppt = pt->fow; - (void)free((char *)pt); + free(pt); arcn->pat = NULL; return(0); } diff --git a/bin/pax/sel_subs.c b/bin/pax/sel_subs.c index b470a4328b0..e0c3fab71f6 100644 --- a/bin/pax/sel_subs.c +++ b/bin/pax/sel_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sel_subs.c,v 1.23 2014/01/08 06:43:34 deraadt Exp $ */ +/* $OpenBSD: sel_subs.c,v 1.24 2014/05/24 18:51:00 guenther Exp $ */ /* $NetBSD: sel_subs.c,v 1.5 1995/03/21 09:07:42 cgd Exp $ */ /*- @@ -109,7 +109,7 @@ usr_add(char *str) if ((str == NULL) || (*str == '\0')) return(-1); if ((usrtb == NULL) && - ((usrtb = (USRT **)calloc(USR_TB_SZ, sizeof(USRT *))) == NULL)) { + ((usrtb = calloc(USR_TB_SZ, sizeof(USRT *))) == NULL)) { paxwarn(1, "Unable to allocate memory for user selection table"); return(-1); } @@ -147,7 +147,7 @@ usr_add(char *str) /* * uid is not yet in the table, add it to the front of the chain */ - if ((pt = (USRT *)malloc(sizeof(USRT))) != NULL) { + if ((pt = malloc(sizeof(USRT))) != NULL) { pt->uid = uid; pt->fow = usrtb[indx]; usrtb[indx] = pt; @@ -206,7 +206,7 @@ grp_add(char *str) if ((str == NULL) || (*str == '\0')) return(-1); if ((grptb == NULL) && - ((grptb = (GRPT **)calloc(GRP_TB_SZ, sizeof(GRPT *))) == NULL)) { + ((grptb = calloc(GRP_TB_SZ, sizeof(GRPT *))) == NULL)) { paxwarn(1, "Unable to allocate memory fo group selection table"); return(-1); } @@ -244,7 +244,7 @@ grp_add(char *str) /* * gid not in the table, add it to the front of the chain */ - if ((pt = (GRPT *)malloc(sizeof(GRPT))) != NULL) { + if ((pt = malloc(sizeof(GRPT))) != NULL) { pt->gid = gid; pt->fow = grptb[indx]; grptb[indx] = pt; @@ -358,7 +358,7 @@ trng_add(char *str) /* * allocate space for the time range and store the limits */ - if ((pt = (TIME_RNG *)malloc(sizeof(TIME_RNG))) == NULL) { + if ((pt = malloc(sizeof(TIME_RNG))) == NULL) { paxwarn(1, "Unable to allocate memory for time range"); return(-1); } @@ -384,7 +384,7 @@ trng_add(char *str) default: paxwarn(1, "Bad option %c with time range %s", *flgpt, str); - (void)free((char *)pt); + free(pt); goto out; } ++flgpt; @@ -401,7 +401,7 @@ trng_add(char *str) */ if (str_sec(str, &(pt->low_time)) < 0) { paxwarn(1, "Illegal lower time range %s", str); - (void)free((char *)pt); + free(pt); goto out; } pt->flgs |= HASLOW; @@ -413,7 +413,7 @@ trng_add(char *str) */ if (str_sec(up_pt, &(pt->high_time)) < 0) { paxwarn(1, "Illegal upper time range %s", up_pt); - (void)free((char *)pt); + free(pt); goto out; } pt->flgs |= HASHIGH; @@ -425,7 +425,7 @@ trng_add(char *str) if (pt->low_time > pt->high_time) { paxwarn(1, "Upper %s and lower %s time overlap", up_pt, str); - (void)free((char *)pt); + free(pt); return(-1); } } diff --git a/bin/pax/tables.c b/bin/pax/tables.c index b898b8946fd..9e8f886e463 100644 --- a/bin/pax/tables.c +++ b/bin/pax/tables.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tables.c,v 1.33 2014/05/24 04:00:06 guenther Exp $ */ +/* $OpenBSD: tables.c,v 1.34 2014/05/24 18:51:00 guenther Exp $ */ /* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */ /*- @@ -104,7 +104,7 @@ lnk_start(void) { if (ltab != NULL) return(0); - if ((ltab = (HRDLNK **)calloc(L_TAB_SZ, sizeof(HRDLNK *))) == NULL) { + if ((ltab = calloc(L_TAB_SZ, sizeof(HRDLNK *))) == NULL) { paxwarn(1, "Cannot allocate memory for hard link table"); return(-1); } @@ -178,8 +178,8 @@ chk_lnk(ARCHD *arcn) */ if (--pt->nlink <= 1) { *ppt = pt->fow; - (void)free((char *)pt->name); - (void)free((char *)pt); + free(pt->name); + free(pt); } return(1); } @@ -189,7 +189,7 @@ chk_lnk(ARCHD *arcn) * we never saw this file before. It has links so we add it to the * front of this hash chain */ - if ((pt = (HRDLNK *)malloc(sizeof(HRDLNK))) != NULL) { + if ((pt = malloc(sizeof(HRDLNK))) != NULL) { if ((pt->name = strdup(arcn->name)) != NULL) { pt->dev = arcn->sb.st_dev; pt->ino = arcn->sb.st_ino; @@ -198,7 +198,7 @@ chk_lnk(ARCHD *arcn) ltab[indx] = pt; return(0); } - (void)free((char *)pt); + free(pt); } paxwarn(1, "Hard link table out of memory"); @@ -254,8 +254,8 @@ purg_lnk(ARCHD *arcn) * remove and free it */ *ppt = pt->fow; - (void)free((char *)pt->name); - (void)free((char *)pt); + free(pt->name); + free(pt); } /* @@ -288,8 +288,8 @@ lnk_end(void) while (pt != NULL) { ppt = pt; pt = ppt->fow; - (void)free((char *)ppt->name); - (void)free((char *)ppt); + free(ppt->name); + free(ppt); } } return; @@ -332,7 +332,7 @@ ftime_start(void) if (ftab != NULL) return(0); - if ((ftab = (FTM **)calloc(F_TAB_SZ, sizeof(FTM *))) == NULL) { + if ((ftab = calloc(F_TAB_SZ, sizeof(FTM *))) == NULL) { paxwarn(1, "Cannot allocate memory for file time table"); return(-1); } @@ -440,7 +440,7 @@ chk_ftime(ARCHD *arcn) /* * not in table, add it */ - if ((pt = (FTM *)malloc(sizeof(FTM))) != NULL) { + if ((pt = malloc(sizeof(FTM))) != NULL) { /* * add the name at the end of the scratch file, saving the * offset. add the file to the head of the hash chain @@ -460,7 +460,7 @@ chk_ftime(ARCHD *arcn) paxwarn(1, "File time table ran out of memory"); if (pt != NULL) - (void)free((char *)pt); + free(pt); return(-1); } @@ -488,7 +488,7 @@ name_start(void) { if (ntab != NULL) return(0); - if ((ntab = (NAMT **)calloc(N_TAB_SZ, sizeof(NAMT *))) == NULL) { + if ((ntab = calloc(N_TAB_SZ, sizeof(NAMT *))) == NULL) { paxwarn(1, "Cannot allocate memory for interactive rename table"); return(-1); } @@ -538,7 +538,7 @@ add_name(char *oname, int onamelen, char *nname) if (strcmp(nname, pt->nname) == 0) return(0); - (void)free((char *)pt->nname); + free(pt->nname); if ((pt->nname = strdup(nname)) == NULL) { paxwarn(1, "Cannot update rename table"); return(-1); @@ -550,16 +550,16 @@ add_name(char *oname, int onamelen, char *nname) /* * this is a new mapping, add it to the table */ - if ((pt = (NAMT *)malloc(sizeof(NAMT))) != NULL) { + if ((pt = malloc(sizeof(NAMT))) != NULL) { if ((pt->oname = strdup(oname)) != NULL) { if ((pt->nname = strdup(nname)) != NULL) { pt->fow = ntab[indx]; ntab[indx] = pt; return(0); } - (void)free((char *)pt->oname); + free(pt->oname); } - (void)free((char *)pt); + free(pt); } paxwarn(1, "Interactive rename table out of memory"); return(-1); @@ -662,7 +662,7 @@ dev_start(void) { if (dtab != NULL) return(0); - if ((dtab = (DEVT **)calloc(D_TAB_SZ, sizeof(DEVT *))) == NULL) { + if ((dtab = calloc(D_TAB_SZ, sizeof(DEVT *))) == NULL) { paxwarn(1, "Cannot allocate memory for device mapping table"); return(-1); } @@ -735,7 +735,7 @@ chk_dev(dev_t dev, int add) * chain. Note we do not assign remaps values here, so the pt->list * list must be NULL. */ - if ((pt = (DEVT *)malloc(sizeof(DEVT))) == NULL) { + if ((pt = malloc(sizeof(DEVT))) == NULL) { paxwarn(1, "Device map table out of memory"); return(NULL); } @@ -827,7 +827,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) * same device number. */ if (!trc_dev && (trunc_bits != 0)) { - if ((dpt = (DLIST *)malloc(sizeof(DLIST))) == NULL) + if ((dpt = malloc(sizeof(DLIST))) == NULL) goto bad; dpt->trunc_bits = 0; dpt->dev = arcn->sb.st_dev; @@ -854,7 +854,7 @@ map_dev(ARCHD *arcn, u_long dev_mask, u_long ino_mask) break; } - if ((lastdev <= 0) || ((dpt = (DLIST *)malloc(sizeof(DLIST))) == NULL)) + if ((lastdev <= 0) || ((dpt = malloc(sizeof(DLIST))) == NULL)) goto bad; /* @@ -905,7 +905,7 @@ atdir_start(void) { if (atab != NULL) return(0); - if ((atab = (ATDIR **)calloc(A_TAB_SZ, sizeof(ATDIR *))) == NULL) { + if ((atab = calloc(A_TAB_SZ, sizeof(ATDIR *))) == NULL) { paxwarn(1,"Cannot allocate space for directory access time table"); return(-1); } @@ -999,7 +999,7 @@ add_atdir(char *fname, dev_t dev, ino_t ino, time_t mtime, time_t atime) sigprocmask(SIG_SETMASK, &savedsigs, NULL); return; } - (void)free((char *)pt); + free(pt); } sigprocmask(SIG_SETMASK, &savedsigs, NULL); @@ -1061,8 +1061,8 @@ get_atdir(dev_t dev, ino_t ino, time_t *mtime, time_t *atime) sigprocmask(SIG_SETMASK, &savedsigs, NULL); *mtime = pt->mtime; *atime = pt->atime; - (void)free((char *)pt->name); - (void)free((char *)pt); + free(pt->name); + free(pt); return(0); } @@ -1104,7 +1104,7 @@ dir_start(void) return(0); dirsize = DIRP_SIZE; - if ((dirp = calloc(dirsize, sizeof(DIRDATA))) == NULL) { + if ((dirp = reallocarray(NULL, dirsize, sizeof(DIRDATA))) == NULL) { paxwarn(1, "Unable to allocate memory for directory times"); return(-1); } |