OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [stdlib/] [strdup_r.c] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
#include <reent.h>
2
#include <stdlib.h>
3
#include <string.h>
4
 
5
char *
6
_DEFUN (_strdup_r, (reent_ptr, str),
7
        struct _reent *reent_ptr  _AND
8
        _CONST char   *str)
9
{
10
  size_t len = strlen (str) + 1;
11
  char *copy = _malloc_r (reent_ptr, len);
12
  if (copy)
13
    {
14
      memcpy (copy, str, len);
15
    }
16
  return copy;
17
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.