- processing of function parameter added (first tests successful)

- next stage -> constructing stub files (.c and .h)
This commit is contained in:
2017-03-03 14:07:38 +00:00
parent 444b9fb078
commit 9557e97bab
8 changed files with 167 additions and 37 deletions

View File

@@ -25,3 +25,49 @@ void* xmalloc(size_t size)
memset(value, 0, size);
return value;
}
char* xmallocStrlcpy(char **aDest, char *aSource, size_t aSize)
{
if (NULL == aSource || 0 == aSize)
{
return NULL;
}
if (NULL != *aDest)
{
*aDest = (char*) realloc(*aDest, aSize + 1);
}
else
{
*aDest = (char*) xmalloc(aSize + 1);
}
if (NULL != *aDest)
{
(void) strlcpy(*aDest, aSource, aSize + 1);
}
return *aDest;
}
char* xmallocStrlcat(char **aDest, char *aSource, size_t aSize)
{
size_t newSize = 0;
if (NULL == aSource || 0 == aSize)
{
return NULL;
}
if (NULL != *aDest)
{
newSize = strlen(*aDest) + aSize + 1;
*aDest = (char*) realloc(*aDest, newSize);
}
else
{
newSize = aSize + 1;
*aDest = (char*) xmalloc(newSize);
}
if (NULL != *aDest)
{
(void) strlcat(*aDest, aSource, newSize);
}
return *aDest;
}