[Mesa-dev] [PATCH 1/3] noop: simplify some functions

Marek Olšák maraeo at gmail.com
Mon Aug 29 18:15:24 UTC 2016


On Mon, Aug 29, 2016 at 7:23 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 29 August 2016 at 16:29, Marek Olšák <maraeo at gmail.com> wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>  src/gallium/drivers/noop/noop_state.c | 56 +++++------------------------------
>>  1 file changed, 7 insertions(+), 49 deletions(-)
>>
>> diff --git a/src/gallium/drivers/noop/noop_state.c b/src/gallium/drivers/noop/noop_state.c
>> index 0c0ad9f..01538bfe27 100644
>> --- a/src/gallium/drivers/noop/noop_state.c
>> +++ b/src/gallium/drivers/noop/noop_state.c
>> @@ -35,63 +35,39 @@ static void noop_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info
>>  }
>>
>>  static void noop_set_blend_color(struct pipe_context *ctx,
>>                                   const struct pipe_blend_color *state)
>>  {
>>  }
>>
>>  static void *noop_create_blend_state(struct pipe_context *ctx,
>>                                       const struct pipe_blend_state *state)
>>  {
>> -   struct pipe_blend_state *nstate = CALLOC_STRUCT(pipe_blend_state);
>> -
>> -   if (!nstate) {
>> -      return NULL;
>> -   }
>> -   *nstate = *state;
>> -   return nstate;
>> +   return malloc(1);
> You want to use [CM]ALLOC to match the FREE.
>
> Mildly related:
> Is the allocator doing to do something special for the 1 byte case or
> it's going to threat it like any other "smaller than bucket size" ?

I have no idea, and I'm not concerned about that.

Marek


More information about the mesa-dev mailing list