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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [libiberty/] [strdup.c] - Diff between revs 1181 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1181 Rev 1765
/*
/*
 
 
@deftypefn Supplemental char* strdup (const char *@var{s})
@deftypefn Supplemental char* strdup (const char *@var{s})
 
 
Returns a pointer to a copy of @var{s} in memory obtained from
Returns a pointer to a copy of @var{s} in memory obtained from
@code{malloc}, or @code{NULL} if insufficient memory was available.
@code{malloc}, or @code{NULL} if insufficient memory was available.
 
 
@end deftypefn
@end deftypefn
 
 
*/
*/
 
 
char *
char *
strdup(s)
strdup(s)
     char *s;
     char *s;
{
{
    char *result = (char*)malloc(strlen(s) + 1);
    char *result = (char*)malloc(strlen(s) + 1);
    if (result == (char*)0)
    if (result == (char*)0)
        return (char*)0;
        return (char*)0;
    strcpy(result, s);
    strcpy(result, s);
    return result;
    return result;
}
}
 
 

powered by: WebSVN 2.1.0

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