On 18/02/2015 12:56, Pavel Dovgalyuk wrote:
> +void replay_read_next_clock(ReplayClockKind kind)

This function is called like this:

> +    if (replay_file) {
> +        int64_t ret;
> +        replay_mutex_lock();
> +        if (skip_async_events(EVENT_CLOCK + kind)) {
> +            replay_read_next_clock(kind);
> +        }

So it seems to me that this section is unnecessary:

> +    replay_fetch_data_kind();
> +    if (replay_file) {
> +        unsigned int read_kind = replay_data_kind - EVENT_CLOCK;
> +
> +        if (read_kind != kind) {
> +            return;
> +        }

1) replay_file must be non-NULL

2) skip_async_events has fetched replay_data_kind

3) replay_data_kind - EVENT_CLOCK must match read_kind

It can be replaced simply with

    assert(replay_has_unread_data);
    assert(replay_data_kind - EVENT_CLOCK == kind);

I suspect there are other cases like this where you have unnecessary
calls to replay_fetch_data_kind().

Paolo

Reply via email to