mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Update strdup(3) to current coding conventions.
This commit is contained in:
parent
fb7db21a1b
commit
1032530ebf
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012, 2014.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
|
@ -27,10 +27,10 @@
|
|||
|
||||
extern "C" char* strdup(const char* input)
|
||||
{
|
||||
size_t inputsize = strlen(input);
|
||||
char* result = (char*) malloc(inputsize + 1);
|
||||
size_t input_length = strlen(input);
|
||||
char* result = (char*) malloc(input_length + 1);
|
||||
if ( !result )
|
||||
return NULL;
|
||||
memcpy(result, input, inputsize + 1);
|
||||
memcpy(result, input, input_length + 1);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue