From 16c2bea50d0dfe5d2439a73baac5b0dde9b5634f Mon Sep 17 00:00:00 2001 From: Ciro Nishiguchi Date: Thu, 7 Nov 2019 16:13:33 -0600 Subject: uhd: Allow device args that have an integer in the name Allow device args that contain an integer within the name, such as recv_offload_thread_0_cpu. Previously this would cause an invalid format exception. --- host/lib/types/device_addr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'host') diff --git a/host/lib/types/device_addr.cpp b/host/lib/types/device_addr.cpp index 3e2fac94d..be6198356 100644 --- a/host/lib/types/device_addr.cpp +++ b/host/lib/types/device_addr.cpp @@ -94,7 +94,11 @@ device_addrs_t uhd::separate_device_addr(const device_addr_t &dev_addr){ std::vector global_keys; //keys that apply to all (no numerical suffix) for(const std::string &key: dev_addr.keys()){ std::cmatch matches; - if (not std::regex_match(key.c_str(), matches, std::regex("^(\\D+)(\\d*)$"))){ + // Key must start with a non-digit, and may optionally end with a digit + // that indicates the mb index. Also allow keys that have integers within + // the name, such as recv_offload_thread_0_cpu. + if (not std::regex_match( + key.c_str(), matches, std::regex("^(\\D+\\d*\\D+)(\\d*)$"))) { throw std::runtime_error("unknown key format: " + key); } std::string key_part(matches[1].first, matches[1].second); -- cgit v1.2.3