Build fix: ParameterWeb had its own (static) version of strndup which broke the build on gcc4. Removed it so as to just use the library version added recently instead.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28946 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -297,27 +297,6 @@ size_left(ssize_t size, const void *bufferStart, const void *buffer)
|
|||||||
* The buffer returned is to be freed by the caller using free().
|
* The buffer returned is to be freed by the caller using free().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *
|
|
||||||
strndup(const char *source, size_t maxBufferSize)
|
|
||||||
{
|
|
||||||
if (source == NULL || source[0] == '\0')
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
uint32 size = strlen(source) + 1;
|
|
||||||
if (size > maxBufferSize)
|
|
||||||
size = maxBufferSize;
|
|
||||||
|
|
||||||
char *target = (char *)malloc(size);
|
|
||||||
if (target == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
memcpy(target, source, size - 1);
|
|
||||||
target[size - 1] = '\0';
|
|
||||||
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user