* [PATCH] tsearch.3: Remove unneeded cast
@ 2020-09-05 11:00 Alejandro Colomar
2020-09-05 15:41 ` Michael Kerrisk (man-pages)
0 siblings, 1 reply; 2+ messages in thread
From: Alejandro Colomar @ 2020-09-05 11:00 UTC (permalink / raw
To: mtk.manpages; +Cc: linux-man, Alejandro Colomar
Casting `int *` to `const void *` is already done implicitly.
Not only that, but the explicit cast to `void *` was slightly
misleading.
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
---
man3/tsearch.3 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man3/tsearch.3 b/man3/tsearch.3
index 65fcadc52..05d0b2170 100644
--- a/man3/tsearch.3
+++ b/man3/tsearch.3
@@ -329,7 +329,7 @@ main(void)
for (i = 0; i < 12; i++) {
ptr = xmalloc(sizeof(*ptr));
*ptr = rand() & 0xff;
- val = tsearch((void *) ptr, &root, compare);
+ val = tsearch(ptr, &root, compare);
if (val == NULL)
exit(EXIT_FAILURE);
else if (*val != ptr)
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tsearch.3: Remove unneeded cast
2020-09-05 11:00 [PATCH] tsearch.3: Remove unneeded cast Alejandro Colomar
@ 2020-09-05 15:41 ` Michael Kerrisk (man-pages)
0 siblings, 0 replies; 2+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-09-05 15:41 UTC (permalink / raw
To: Alejandro Colomar; +Cc: mtk.manpages, linux-man
On 9/5/20 1:00 PM, Alejandro Colomar wrote:
> Casting `int *` to `const void *` is already done implicitly.
> Not only that, but the explicit cast to `void *` was slightly
> misleading.
>
> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
> ---
> man3/tsearch.3 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/man3/tsearch.3 b/man3/tsearch.3
> index 65fcadc52..05d0b2170 100644
> --- a/man3/tsearch.3
> +++ b/man3/tsearch.3
> @@ -329,7 +329,7 @@ main(void)
> for (i = 0; i < 12; i++) {
> ptr = xmalloc(sizeof(*ptr));
> *ptr = rand() & 0xff;
> - val = tsearch((void *) ptr, &root, compare);
> + val = tsearch(ptr, &root, compare);
> if (val == NULL)
> exit(EXIT_FAILURE);
> else if (*val != ptr)
Thanks, Alex. Patch applied.
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-05 15:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-05 11:00 [PATCH] tsearch.3: Remove unneeded cast Alejandro Colomar
2020-09-05 15:41 ` Michael Kerrisk (man-pages)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.