From 42c39c4642733aec4aa34afb5627f986abfed030 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Wed, 15 Apr 2020 08:23:20 -0400 Subject: [PATCH] Fix pal_io.c code based on code review suggestions (#34970) These suggestions were provided by @lpereira on https://github.com/dotnet/corefx/pull/42900 --- src/libraries/Native/Unix/System.Native/pal_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libraries/Native/Unix/System.Native/pal_io.c b/src/libraries/Native/Unix/System.Native/pal_io.c index 6090846..4c5af27 100644 --- a/src/libraries/Native/Unix/System.Native/pal_io.c +++ b/src/libraries/Native/Unix/System.Native/pal_io.c @@ -932,15 +932,15 @@ int32_t SystemNative_Poll(PollEvent* pollEvents, uint32_t eventCount, int32_t mi } struct pollfd stackBuffer[(uint32_t)(2048/sizeof(struct pollfd))]; - int useStackBuffer = eventCount <= (sizeof(stackBuffer)/sizeof(stackBuffer[0])); + int useStackBuffer = eventCount <= ARRAY_SIZE(stackBuffer); struct pollfd* pollfds = NULL; if (useStackBuffer) { - pollfds = (struct pollfd*)&stackBuffer[0]; + pollfds = &stackBuffer[0]; } else { - pollfds = (struct pollfd*)calloc(eventCount, sizeof(*pollfds)); + pollfds = calloc(eventCount, sizeof(*pollfds)); if (pollfds == NULL) { return Error_ENOMEM; -- 2.7.4