improve managed object name creation

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@35786 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-11-08 11:28:36 +00:00
parent a08ead3650
commit b320fe92e5

View file

@ -51,11 +51,9 @@ EcMakeManagedObject(NSString *host, NSString *process, NSString *component)
{
host = [[NSHost currentHost] wellKnownName];
}
else
{
// No underscores permitted.
host = [host stringByReplacingString: @"_" withString: @"-"];
}
// No underscores permitted.
host = [host stringByTrimmingSpaces];
host = [host stringByReplacingString: @"_" withString: @"-"];
if (nil == process)
{
@ -91,17 +89,17 @@ EcMakeManagedObject(NSString *host, NSString *process, NSString *component)
}
}
// No underscores permitted.
process = [process stringByTrimmingSpaces];
process = [process stringByReplacingString: @"_" withString: @"-"];
if (nil == component)
{
component = @"";
}
else
{
// No underscores permitted.
component = [component stringByReplacingString: @"_" withString: @"-"];
}
// No underscores permitted.
component = [component stringByTrimmingSpaces];
component = [component stringByReplacingString: @"_" withString: @"-"];
return [NSString stringWithFormat: @"%@_%@_%@_%@",
host, process, instance, component];