Changeset 33b8d024 in mainline for uspace/lib/c/generic/malloc.c


Ignore:
Timestamp:
2018-01-16T20:38:46Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2467b41
Parents:
d39c46e0
Message:

Remove const qualifier from the argument of free() and realloc(),
as well as in numerous other variables that hold ownership of memory.

By convention, a pointer that holds ownership is _never_ qualified by const.
This is reflected in the standard type signature of free() and realloc().
Allowing const pointers to hold ownership may seem superficially convenient,
but is actually quite confusing to experienced C programmers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/malloc.c

    rd39c46e0 r33b8d024  
    874874 *
    875875 */
    876 void *realloc(const void *addr, const size_t size)
     876void *realloc(void * const addr, const size_t size)
    877877{
    878878        if (size == 0) {
     
    988988 *
    989989 */
    990 void free(const void *addr)
     990void free(void * const addr)
    991991{
    992992        if (addr == NULL)
Note: See TracChangeset for help on using the changeset viewer.