strdup.c 410 B

12345678910111213141516171819202122
  1. #include <ogg/os_types.h>
  2. #include <sys/types.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. char *strdup(const char *inStr)
  6. {
  7. char *outStr = NULL;
  8. if (inStr == NULL) {
  9. return NULL;
  10. }
  11. outStr = _ogg_malloc(strlen(inStr) + 1);
  12. if (outStr != NULL) {
  13. strcpy(outStr, inStr);
  14. }
  15. return outStr;
  16. }