aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2019-11-07 16:13:33 -0600
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:33 -0800
commit16c2bea50d0dfe5d2439a73baac5b0dde9b5634f (patch)
tree234c5f1329323a6e4a1c6d9668dbc39995b655e3 /host
parent025ffdce3475585b3f65e955af32afbab9181e13 (diff)
downloaduhd-16c2bea50d0dfe5d2439a73baac5b0dde9b5634f.tar.gz
uhd-16c2bea50d0dfe5d2439a73baac5b0dde9b5634f.tar.bz2
uhd-16c2bea50d0dfe5d2439a73baac5b0dde9b5634f.zip
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.
Diffstat (limited to 'host')
-rw-r--r--host/lib/types/device_addr.cpp6
1 files changed, 5 insertions, 1 deletions
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<std::string> 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);