Added a comment about why not using the strdup c function
This commit is contained in:
parent
2cf047f4ff
commit
a67354cd84
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
AbstractParser::AbstractParser(const char *resource) : _resource(NULL)
|
AbstractParser::AbstractParser(const char *resource) : _resource(NULL)
|
||||||
{
|
{
|
||||||
|
//Could use strdup instead, but has bigger flash memory footprint :(, sticking to this technique instead.
|
||||||
_resource = (char *) malloc((strlen(resource) * sizeof(char)) + 1); //+1 for the string terminating character
|
_resource = (char *) malloc((strlen(resource) * sizeof(char)) + 1); //+1 for the string terminating character
|
||||||
strcpy(_resource, resource);
|
strcpy(_resource, resource);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user