This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] malloc: Use current (C11-style) atomics for fastbin access


* DJ Delorie:

> Florian Weimer <fweimer@redhat.com> writes:
>> 	* malloc/malloc.c (fastbin_push_entry): New function.
>> 	(fastbin_pop_entry): Likewise.  Replaces REMOVE_FB.
>> 	(REMOVE_FB): Remove macro.
>> 	(_int_malloc): Use fastbin_pop_entry and reindent.
>> 	(_int_free): Use fastbin_push_entry.
>> 	(malloc_consolidate): Use atomic_exchange_acquire.
>
> All good with one minor nit...
>
>> +	if (head == NULL)
>> +	  return NULL;
>> +	else
>> +	  tail = head->fd;
>
> This "else" is superfluous.  You can just have the tail = head->fd;
> statement after the "return NULL;".  I think putting it in an "else"
> makes the (false) claim that it might have been executed otherwise.

Actually, it's not, due to the surrounding do-while.  I'll remove the
else and add braces, though.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]