Use return value of memset() to enable tail call optimizations.
---
 cpukit/libcsupport/src/calloc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/cpukit/libcsupport/src/calloc.c b/cpukit/libcsupport/src/calloc.c
index 20db533786..78b08ab5a5 100644
--- a/cpukit/libcsupport/src/calloc.c
+++ b/cpukit/libcsupport/src/calloc.c
@@ -28,15 +28,16 @@ void *calloc(
   size_t elsize
 )
 {
-  char   *cptr;
+  void   *cptr;
   size_t  length;
 
   length = nelem * elsize;
   cptr = malloc( length );
   RTEMS_OBFUSCATE_VARIABLE( cptr );
-  if ( cptr )
-    memset( cptr, '\0', length );
+  if ( RTEMS_PREDICT_FALSE( cptr == NULL ) ) {
+    return cptr;
+  }
 
-  return cptr;
+  return memset( cptr, 0, length );
 }
 #endif
-- 
2.13.7

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to