X-Git-Url: https://git.cworth.org/git?p=apitrace;a=blobdiff_plain;f=cli%2Fcli_trim.cpp;h=13436705dbe71aebe982e34b4b818311255c7e20;hp=b0cb8f167557fbe162b174a50ddf2610ce905b2b;hb=18198bc20331e48f45fc0c36cb3f256a58e24e4b;hpb=896811606399ebc083ff6304b7f629a93830ba0d diff --git a/cli/cli_trim.cpp b/cli/cli_trim.cpp index b0cb8f1..1343670 100644 --- a/cli/cli_trim.cpp +++ b/cli/cli_trim.cpp @@ -196,11 +196,11 @@ trim_trace(const char *filename, struct trim_options *options) trace::Call *call; while ((call = p.parse_call())) { - /* There's no use doing any work past the last call or frame + /* There's no use doing any work past the last call and frame * requested by the user. */ - if (call->no > options->calls.getLast() || - frame > options->frames.getLast()) { - + if ((options->calls.empty() || call->no > options->calls.getLast()) && + (options->frames.empty() || frame > options->frames.getLast())) { + delete call; break; } @@ -264,10 +264,10 @@ trim_trace(const char *filename, struct trim_options *options) call_range_last = -1; while ((call = p.parse_call())) { - /* There's no use doing any work past the last call or frame + /* There's no use doing any work past the last call and frame * requested by the user. */ - if (call->no > options->calls.getLast() || - frame > options->frames.getLast()) { + if ((options->calls.empty() || call->no > options->calls.getLast()) && + (options->frames.empty() || frame > options->frames.getLast())) { break; }