diff options
author | Jim Meyering <jim@meyering.net> | 2006-10-06 14:37:48 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-10-06 14:37:48 +0000 |
commit | 0fc6edb71490b03c79dd03c903a4b72ce2a23d81 (patch) | |
tree | 6777b999c57c0f2f210b3068b8d7e145ac0561fc /lib | |
parent | c620aeeb900f26c658fbb9cbcbf160bee9290610 (diff) | |
download | coreutils-0fc6edb71490b03c79dd03c903a4b72ce2a23d81.tar.xz |
Avoid a compiler warning: const'ify and remove a cast.
* randread.c (struct randread_source) [handler]: Make parameter "const".
[handler_arg]: Add "const" attribute.
(randread_error): Make parameter "const".
(simple_new, randread_set_handler, randread_set_handler_arg): Likewise.
(randread_new): Remove now-unnecessary cast.
* randread.h: Adjust prototypes.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 10 | ||||
-rw-r--r-- | lib/randread.c | 14 | ||||
-rw-r--r-- | lib/randread.h | 4 |
3 files changed, 19 insertions, 9 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index a74ee151d..ed110f84c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,13 @@ +2006-10-06 Jim Meyering <jim@meyering.net> + + Avoid a compiler warning: const'ify and remove a cast. + * randread.c (struct randread_source) [handler]: Make parameter "const". + [handler_arg]: Add "const" attribute. + (randread_error): Make parameter "const". + (simple_new, randread_set_handler, randread_set_handler_arg): Likewise. + (randread_new): Remove now-unnecessary cast. + * randread.h: Adjust prototypes. + 2006-09-29 Paul Eggert <eggert@cs.ucla.edu> * .cvsignore: Add openat-proc.c. diff --git a/lib/randread.c b/lib/randread.c index 28796fe49..b761fa5bd 100644 --- a/lib/randread.c +++ b/lib/randread.c @@ -82,8 +82,8 @@ struct randread_source there was an error. If this function returns, it should fix the problem before returning. The default handler assumes that handler_arg is the file name of the source. */ - void (*handler) (void *); - void *handler_arg; + void (*handler) (void const *); + void const *handler_arg; /* The buffer for SOURCE. It's kept here to simplify storage allocation and to make it easier to clear out buffered random @@ -116,7 +116,7 @@ struct randread_source /* The default error handler. */ static void -randread_error (void *file_name) +randread_error (void const *file_name) { if (file_name) error (exit_failure, errno, @@ -129,7 +129,7 @@ randread_error (void *file_name) handler. */ static struct randread_source * -simple_new (FILE *source, void *handler_arg) +simple_new (FILE *source, void const *handler_arg) { struct randread_source *s = xmalloc (sizeof *s); s->source = source; @@ -167,7 +167,7 @@ randread_new (char const *name, size_t bytes_bound) file_name = NULL; } - s = simple_new (source, (void *) file_name); + s = simple_new (source, file_name); if (source) setvbuf (source, s->buf.c, _IOFBF, MIN (sizeof s->buf.c, bytes_bound)); @@ -190,13 +190,13 @@ randread_new (char const *name, size_t bytes_bound) does not return. */ void -randread_set_handler (struct randread_source *s, void (*handler) (void *)) +randread_set_handler (struct randread_source *s, void (*handler) (void const *)) { s->handler = handler; } void -randread_set_handler_arg (struct randread_source *s, void *handler_arg) +randread_set_handler_arg (struct randread_source *s, void const *handler_arg) { s->handler_arg = handler_arg; } diff --git a/lib/randread.h b/lib/randread.h index b256386d2..8e34334a7 100644 --- a/lib/randread.h +++ b/lib/randread.h @@ -27,8 +27,8 @@ struct randread_source; struct randread_source *randread_new (char const *, size_t); void randread (struct randread_source *, void *, size_t); -void randread_set_handler (struct randread_source *, void (*) (void *)); -void randread_set_handler_arg (struct randread_source *, void *); +void randread_set_handler (struct randread_source *, void (*) (void const *)); +void randread_set_handler_arg (struct randread_source *, void const *); int randread_free (struct randread_source *); #endif |