src/stdlib/SDL_string.c
changeset 11610 6dea196ecbcb
parent 11451 b96f291a772e
child 11811 5d94cb6b24d3
equal deleted inserted replaced
11607:db7ee6a1ba6a 11610:6dea196ecbcb
   559 }
   559 }
   560 
   560 
   561 char *
   561 char *
   562 SDL_strdup(const char *string)
   562 SDL_strdup(const char *string)
   563 {
   563 {
   564 #if defined(HAVE_STRDUP)
       
   565     return strdup(string);
       
   566 #else
       
   567     size_t len = SDL_strlen(string) + 1;
   564     size_t len = SDL_strlen(string) + 1;
   568     char *newstr = SDL_malloc(len);
   565     char *newstr = SDL_malloc(len);
   569     if (newstr) {
   566     if (newstr) {
   570         SDL_strlcpy(newstr, string, len);
   567         SDL_strlcpy(newstr, string, len);
   571     }
   568     }
   572     return newstr;
   569     return newstr;
   573 #endif /* HAVE_STRDUP */
       
   574 }
   570 }
   575 
   571 
   576 char *
   572 char *
   577 SDL_strrev(char *string)
   573 SDL_strrev(char *string)
   578 {
   574 {