use C++ for PortManager::make_port_name_relative()
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 7 Oct 2015 17:16:22 +0000 (13:16 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 7 Oct 2015 17:17:49 +0000 (13:17 -0400)
libs/ardour/port_manager.cc

index e4c066944f4b139d20da98d5cb83d9409dd52be5..5b8693e5488a49b7ef11e4e2a02d49f52cadc82d 100644 (file)
@@ -75,20 +75,14 @@ PortManager::make_port_name_relative (const string& portname) const
                return portname;
        }
 
-       string::size_type len;
-       string::size_type n;
-       string self = _backend->my_name();
-
-       len = portname.length();
+       string::size_type colon = portname.find (':');
 
-       for (n = 0; n < len; ++n) {
-               if (portname[n] == ':') {
-                       break;
-               }
+       if (colon == string::npos) {
+               return portname;
        }
 
-       if ((n != len) && (portname.substr (0, n) == self)) {
-               return portname.substr (n+1);
+       if (portname.substr (0, colon) == _backend->my_name()) {
+               return portname.substr (colon+1);
        }
 
        return portname;