Changeset 313f897 in rtems


Ignore:
Timestamp:
Sep 13, 2018, 12:50:08 PM (15 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
8777d4c
Parents:
1ad43f8
git-author:
Sebastian Huber <sebastian.huber@…> (09/13/18 12:50:08)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/04/18 06:02:29)
Message:

Optimize calloc()

Use return value of memset() to enable tail call optimizations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/calloc.c

    r1ad43f8 r313f897  
    2929)
    3030{
    31   char   *cptr;
     31  void   *cptr;
    3232  size_t  length;
    3333
     
    3535  cptr = malloc( length );
    3636  RTEMS_OBFUSCATE_VARIABLE( cptr );
    37   if ( cptr )
    38     memset( cptr, '\0', length );
     37  if ( RTEMS_PREDICT_FALSE( cptr == NULL ) ) {
     38    return cptr;
     39  }
    3940
    40   return cptr;
     41  return memset( cptr, 0, length );
    4142}
    4243#endif
Note: See TracChangeset for help on using the changeset viewer.