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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [stdlib/] [strdup.c] - Blame information for rev 40

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

Line No. Rev Author Line
1 39 lampret
#include <stdlib.h>
2
#include <string.h>
3
 
4
char *
5
_DEFUN (strdup, (str), _CONST char *str)
6
{
7
  size_t len = strlen (str) + 1;
8
  char *copy = malloc (len);
9
  if (copy)
10
    {
11
      memcpy (copy, str, len);
12
    }
13
  return copy;
14
}

powered by: WebSVN 2.1.0

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