aboutsummaryrefslogtreecommitdiffstats
path: root/bba
diff options
context:
space:
mode:
authorMarcin Kościelnicki <marcin@symbioticeda.com>2019-03-12 18:18:56 +0100
committerMarcin Kościelnicki <marcin@symbioticeda.com>2019-03-12 18:18:56 +0100
commitb1d345c23379c62f809013634c8df11719ea00cd (patch)
tree8bd39371c3954f20388187555f11699b8663e393 /bba
parent97993e76eabb6ac32c50871aa618d53b35118736 (diff)
downloadnextpnr-b1d345c23379c62f809013634c8df11719ea00cd.tar.gz
nextpnr-b1d345c23379c62f809013634c8df11719ea00cd.tar.bz2
nextpnr-b1d345c23379c62f809013634c8df11719ea00cd.zip
bba: Fix str with empty string.
Signed-off-by: Marcin Kościelnicki <marcin@symbioticeda.com>
Diffstat (limited to 'bba')
-rw-r--r--bba/main.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/bba/main.cc b/bba/main.cc
index 263cf39e..0d4181c5 100644
--- a/bba/main.cc
+++ b/bba/main.cc
@@ -181,10 +181,11 @@ int main(int argc, char **argv)
if (cmd == "str") {
const char *value = skipWhitespace(strtok(nullptr, "\r\n"));
- char terminator[2] = {*value, 0};
- assert(terminator[0] != 0);
- value = strtok((char *)value + 1, terminator);
- const char *comment = skipWhitespace(strtok(nullptr, "\r\n"));
+ assert(*value != 0);
+ char *end = strchr((char *)value + 1, *value);
+ *end = 0;
+ value += 1;
+ const char *comment = skipWhitespace(strtok(end+1, "\r\n"));
std::string label = std::string("str:") + value;
Stream &s = streams.at(streamStack.back());
if (labelIndex.count(label) == 0) {