Am 01.08.21 um 12:57 schrieb Ichthyostega:
I just searched for stoi and got 14 hits, so that proposal would be rather
easy to carry out. Taking a closer look, these 14 hits are all not
performance critical, so we could even put in diagnostics there
unconditionally. Especially those three usages in main.cpp look promising
:-D
Reconsidering my first spontaneous answer...
Most of those hits are somewhere GUI related, and I'd be surprised if they cause
a failure at startup.
Only those three usages in main.cpp stand out, maybe together with the usage in
the (generated) MasterUI, which is also related to the Instance-ID.
std::string firstText = runCommand("pgrep -o -x yoshimi", false);
int firstpid = std::stoi(firstText);
int firstTime = std::stoi(runCommand("ps -o etime= -p " + firstText, true));
int secondTime = std::stoi(runCommand("ps -o etime= -p " +
std::to_string(getpid()), true));
Since those three usages all have something to do with parsing the output of a
system command, it looks like a valid assumption that under some conditions
this system command just didn't produce the expected output. Thus I'd propose
we wrap just these three calls into an inlined helper function, which prints
out the raw string in case it's not readable as int.
-- Hermann
_______________________________________________
Yoshimi-devel mailing list
Yoshimi-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/yoshimi-devel