Re: [PATCH 17/22] Simplify ui-out level code

Pedro Alves
2016-11-30T12:08:01Z

On 11/26/2016 04:39 PM, Simon Marchi wrote:
> On 2016-11-24 13:42, Pedro Alves wrote:
>> On 11/24/2016 03:27 PM, Simon Marchi wrote:
>>> /* Discard the current level, return the discarded level's index.
>>
>> "return the..." is stale.
>
> Indeed, both for push_level and pop_level.
>
>>> specified after table_body and inside a list."));
>>> /* NOTE: cagney/2001-12-08: There was a check here to ensure
>>> - that this code was only executed when uiout->level was
>>> + that this code was only executed when uiout->level () was
>>> greater than zero. That no longer applies - this code is run
>>> before each table row tuple is started and at that point the
>>> level is zero. */
>>
>> This is talking about level zero. Should we just delete the whole
>> comment?
>
> Yes, I think so. I don't like this kind of comment very much, since
> they are not so relevant after some time. After 15 years, I think we
> can assume whoever needed to see it has seen it. I removed it locally.
>
>>> @@ -906,11 +897,9 @@ ui_out_new (const struct ui_out_impl *impl, void
>>> *data,
>>> uiout->flags = flags;
>>> uiout->table.flag = 0;
>>> uiout->table.body_flag = 0;
>>> - uiout->level = 0;
>>>
>>> - /* Create uiout->level 0, the default level. */
>>> - std::unique_ptr<ui_out_level> level (new ui_out_level
>>> (ui_out_type_tuple));
>>> - uiout->levels.push_back (std::move (level));
>>> + /* Create uiout->level () 0, the default level. */
>>> + push_level (uiout, ui_out_type_tuple);
>>
>> level 0 again?
>
> Changed to:
>
> /* Create the ui-out level #1, the default level. */

Sounds good.

Thanks,
Pedro Alves