OpusReader: don't use strndup()

Eliminate the fallback strndup() and strnlen() implementations.
This commit is contained in:
Max Kellermann
2013-04-09 01:03:44 +02:00
parent 2090911363
commit 14df240f5b
4 changed files with 4 additions and 67 deletions

View File

@@ -21,7 +21,6 @@
#define MPD_OPUS_READER_HXX
#include "check.h"
#include "string_util.h"
#include <stdint.h>
#include <string.h>
@@ -91,7 +90,10 @@ public:
if (src == nullptr)
return nullptr;
return strndup(src, length);
char *dest = new char[length + 1];
memcpy(dest, src, length);
dest[length] = 0;
return dest;
}
};