Replace all the lines of the form:
if (strlen (memory.m_nameA) == 0)
with
if( *memory.m_nameA == '\0' )
That will remove the dependency on strlen()
and string.h. Testing for an empty string is a special case that does not require you to determine the length of the string. If you are not using it elsewhere, it will be removed entirely from the code.
In fact you have unnecessary repeated code selected on an index. Use a look-up table instead:
void SetName (int iNewName)
{
static const char* lookup[] = { memory.m_nameA,
memory.m_nameB,
memory.m_nameC,
memory.m_nameD,
memory.m_nameE } ;
while (iName != iNewName)
{
iNewName = 1;
if( byNewName < sizeof(lookup) / sizeof(*lookup) )
{
if( *lookup[byNewName] == '\0' )
{
new_name++;
}
else
{
iName = iNewName;
}
}
} // end of loop
}
If the names in memory
were already an array, then you would not need a look-up table at all.