avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [bug #23677] Request for cbrt() and strdup to be adde


From: Russell Shaw
Subject: Re: [avr-libc-dev] [bug #23677] Request for cbrt() and strdup to be added to libc
Date: Mon, 23 Jun 2008 12:59:22 +1000
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

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);
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]