Changeset 52c7cb1 in rtems


Ignore:
Timestamp:
Nov 21, 2018, 4:30:22 PM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
69812aa
Parents:
59e7209f
git-author:
Sebastian Huber <sebastian.huber@…> (11/21/18 16:30:22)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/21/18 17:06:01)
Message:

score: Simplify _Workspace_String_duplicate()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/wkstringduplicate.c

    r59e7209f r52c7cb1  
    3131char *_Workspace_String_duplicate(
    3232  const char *string,
    33   size_t len
     33  size_t      len
    3434)
    3535{
    36   char *dup = _Workspace_Allocate(len + 1);
     36  char *dup;
    3737
    38   if (dup != NULL) {
    39     dup [len] = '\0';
    40     memcpy(dup, string, len);
     38  dup = _Workspace_Allocate( len + 1 );
     39  if ( dup == NULL ) {
     40    return NULL;
    4141  }
    4242
    43   return dup;
     43  dup[ len ] = '\0';
     44  return memcpy( dup, string, len );
    4445}
Note: See TracChangeset for help on using the changeset viewer.