OPTIM: tools/str2net: only duplicate the string when a slash is present
The str2net() and str62net() functions systematically strdup() the
input pattern before parsing it, while this is only needed when a '/'
is present. Given that this '/' is already looked up, better move the
allocation inside that block so that no allocation is performed when
none is present.
Doing so saves ~5% load time on plain IPv4 addresses and ~8% on plain
IPv6 addresses, while not changing anything for addresses with masks.