Russell Shaw wrote:
Andy Hutchinson wrote:
URL:
<http://savannah.nongnu.org/bugs/?23677>
Summary: Request for cbrt() and strdup to be added to
libc
Project: AVR C Runtime Library
Submitted by: hutchinsonandy
Submitted on: Sunday 06/22/2008 at 21:51
Category: Feature Request
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: libc code
Status: None
Percent Complete: 0%
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Release: Any
Fixed Release: None
_______________________________________________________
Details:
...
char * strdup( const char *str)
{
unsigned int len;
char *copy;
len = strlen(str) + 1;
copy = malloc(len);
if (!copy)
return (copy);
memcpy(copy, str, len);
return (copy);
}
char *strdup(const char *str)
{
if(!str) {
return NULL;
}
return strdup(str);
}
I forgot this is libc.
char *strdup(const char *str)
{
if(!str)
return NULL;
unsigned int len = strlen(str) + 1;
char *copy = malloc(len);
if(!copy)
return NULL;
memcpy(copy, str, len);
return (copy);
}
_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev