From 4d4e2f5ae55de453ef343b22e98bc5bc7b1b976e Mon Sep 17 00:00:00 2001 From: tedu Date: Thu, 22 Jan 2015 22:38:55 +0000 Subject: [PATCH] delete useless casts. ok deraadt guenther millert --- usr.sbin/cron/atrun.c | 6 +++--- usr.sbin/cron/cron.c | 10 +++++----- usr.sbin/cron/entry.c | 4 ++-- usr.sbin/cron/job.c | 4 ++-- usr.sbin/cron/misc.c | 8 ++++---- usr.sbin/cron/user.c | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c index 5a573d9415a..74b3ff955d0 100644 --- a/usr.sbin/cron/atrun.c +++ b/usr.sbin/cron/atrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atrun.c,v 1.24 2015/01/19 01:05:32 deraadt Exp $ */ +/* $OpenBSD: atrun.c,v 1.25 2015/01/22 22:38:55 tedu Exp $ */ /* * Copyright (c) 2002-2003 Todd C. Miller @@ -91,7 +91,7 @@ scan_atjobs(at_db *old_db, struct timeval *tv) continue; queue = (unsigned char)ep[1]; - job = (atjob *)malloc(sizeof(*job)); + job = malloc(sizeof(*job)); if (job == NULL) { for (job = new_db.head; job != NULL; ) { tjob = job; @@ -392,7 +392,7 @@ run_job(atjob *job, char *atfile) log_close(); /* Connect grandchild's stdin to the at job file. */ - if (lseek(fd, (off_t) 0, SEEK_SET) < 0) { + if (lseek(fd, 0, SEEK_SET) < 0) { perror("lseek"); _exit(EXIT_FAILURE); } diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c index 3ca77b874ed..e827b2419ba 100644 --- a/usr.sbin/cron/cron.c +++ b/usr.sbin/cron/cron.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cron.c,v 1.47 2015/01/14 17:27:29 millert Exp $ */ +/* $OpenBSD: cron.c,v 1.48 2015/01/22 22:38:55 tedu Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -137,11 +137,11 @@ main(int argc, char *argv[]) { cronSock = open_socket(); database.head = NULL; database.tail = NULL; - database.mtime = (time_t) 0; + database.mtime = 0; load_database(&database); at_database.head = NULL; at_database.tail = NULL; - at_database.mtime = (time_t) 0; + at_database.mtime = 0; scan_atjobs(&at_database, NULL); set_time(TRUE); run_reboot_jobs(&database); @@ -409,7 +409,7 @@ cron_sleep(time_t target) { (void) read(fd, &poke, 1); close(fd); if (poke & RELOAD_CRON) { - database.mtime = (time_t)0; + database.mtime = 0; load_database(&database); } if (poke & RELOAD_AT) { @@ -419,7 +419,7 @@ cron_sleep(time_t target) { * jobs immediately. */ gettimeofday(&t2, NULL); - at_database.mtime = (time_t)0; + at_database.mtime = 0; if (scan_atjobs(&at_database, &t2)) atrun(&at_database, batch_maxload, t2.tv_sec); diff --git a/usr.sbin/cron/entry.c b/usr.sbin/cron/entry.c index 2a4fffdd971..547be2fa536 100644 --- a/usr.sbin/cron/entry.c +++ b/usr.sbin/cron/entry.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entry.c,v 1.35 2015/01/14 17:27:51 millert Exp $ */ +/* $OpenBSD: entry.c,v 1.36 2015/01/22 22:38:55 tedu Exp $ */ /* * Copyright 1988,1990,1993,1994 by Paul Vixie @@ -103,7 +103,7 @@ load_entry(FILE *file, void (*error_func)(const char *), struct passwd *pw, * of a list of minutes. */ - e = (entry *) calloc(sizeof(entry), sizeof(char)); + e = calloc(sizeof(entry), sizeof(char)); if (e == NULL) { ecode = e_memory; goto eof; diff --git a/usr.sbin/cron/job.c b/usr.sbin/cron/job.c index 2bc2c049122..aa18dee8cad 100644 --- a/usr.sbin/cron/job.c +++ b/usr.sbin/cron/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.8 2009/10/27 23:59:51 deraadt Exp $ */ +/* $OpenBSD: job.c,v 1.9 2015/01/22 22:38:55 tedu Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -41,7 +41,7 @@ job_add(entry *e, user *u) { return; /* build a job queue element */ - if ((j = (job *)malloc(sizeof(job))) == NULL) + if ((j = malloc(sizeof(job))) == NULL) return; j->next = NULL; j->e = e; diff --git a/usr.sbin/cron/misc.c b/usr.sbin/cron/misc.c index f3a1ef56cbb..158b4c17c90 100644 --- a/usr.sbin/cron/misc.c +++ b/usr.sbin/cron/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.50 2015/01/14 17:27:30 millert Exp $ */ +/* $OpenBSD: misc.c,v 1.51 2015/01/22 22:38:55 tedu Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -291,9 +291,9 @@ acquire_daemonlock(int closeflag) { } snprintf(buf, sizeof(buf), "%ld\n", (long)getpid()); - (void) lseek(fd, (off_t)0, SEEK_SET); + (void) lseek(fd, 0, SEEK_SET); num = write(fd, buf, strlen(buf)); - (void) ftruncate(fd, (off_t)num); + (void) ftruncate(fd, num); /* abandon fd even though the file is open. we need to keep * it open and locked, but we don't need the handles elsewhere. @@ -333,7 +333,7 @@ get_string(char *string, int size, FILE *file, char *terms) { while (EOF != (ch = get_char(file)) && !strchr(terms, ch)) { if (size > 1) { - *string++ = (char) ch; + *string++ = ch; size--; } } diff --git a/usr.sbin/cron/user.c b/usr.sbin/cron/user.c index 29643f424bb..bca609d071e 100644 --- a/usr.sbin/cron/user.c +++ b/usr.sbin/cron/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.8 2009/10/27 23:59:51 deraadt Exp $ */ +/* $OpenBSD: user.c,v 1.9 2015/01/22 22:38:55 tedu Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -56,7 +56,7 @@ load_user(int crontab_fd, struct passwd *pw, const char *name) { /* file is open. build user entry, then read the crontab file. */ - if ((u = (user *) malloc(sizeof(user))) == NULL) + if ((u = malloc(sizeof(user))) == NULL) return (NULL); if ((u->name = strdup(name)) == NULL) { save_errno = errno; -- 2.20.1