Changeset 34120f10 in mainline for uspace/lib/c/generic/malloc.c


Ignore:
Timestamp:
2023-10-27T19:38:31Z (7 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
63ed840
Parents:
c89ae25 (diff), 694ca3d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge code deduplication work

TL;DR: Added directory /common, which now contains the sole existing
copy of ADT, printf_core, and a few other pieces. Should make changes
to any of those less of a headache.

File:
1 edited

Legend:

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

    rc89ae25 r34120f10  
    3434 */
    3535
    36 #include <malloc.h>
     36#include <stdlib.h>
    3737#include <stdalign.h>
    3838#include <stdbool.h>
     
    4747#include <stdlib.h>
    4848#include <adt/gcdlcm.h>
     49#include <malloc.h>
    4950
    5051#include "private/malloc.h"
     
    773774}
    774775
    775 /** Allocate memory by number of elements
    776  *
    777  * @param nmemb Number of members to allocate.
    778  * @param size  Size of one member in bytes.
    779  *
    780  * @return Allocated memory or NULL.
    781  *
    782  */
    783 void *calloc(const size_t nmemb, const size_t size)
    784 {
    785         // FIXME: Check for overflow
    786 
    787         void *block = malloc(nmemb * size);
    788         if (block == NULL)
    789                 return NULL;
    790 
    791         memset(block, 0, nmemb * size);
    792         return block;
    793 }
    794 
    795776/** Allocate memory
    796777 *
Note: See TracChangeset for help on using the changeset viewer.