Changeset 44e8541 in mainline for uspace


Ignore:
Timestamp:
2023-10-27T17:38:32Z (2 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
fdfb24e
Parents:
b169619
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-27 15:17:18)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-27 17:38:32)
Message:

Move stdlib.h and some of its function into /common

Location:
uspace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/mm/common.c

    rb169619 r44e8541  
    3535#include <stdlib.h>
    3636#include <errno.h>
     37#include <malloc.h>
    3738#include "../tester.h"
    3839#include "common.h"
  • uspace/lib/c/generic/malloc.c

    rb169619 r44e8541  
    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 *
  • uspace/lib/c/include/malloc.h

    rb169619 r44e8541  
    3939#include <_bits/decls.h>
    4040
    41 __C_DECLS_BEGIN;
    42 
    43 extern void *malloc(size_t size)
    44     __attribute__((malloc));
    45 extern void *calloc(size_t nmemb, size_t size)
    46     __attribute__((malloc));
    47 extern void *realloc(void *addr, size_t size)
    48     __attribute__((warn_unused_result));
    49 extern void free(void *addr);
    50 
    51 __C_DECLS_END;
    52 
    5341#ifdef _HELENOS_SOURCE
    5442__HELENOS_DECLS_BEGIN;
    5543
    56 extern void *memalign(size_t align, size_t size)
    57     __attribute__((malloc));
    5844extern void *heap_check(void);
    5945
  • uspace/lib/c/meson.build

    rb169619 r44e8541  
    6262src += files(
    6363        'common/stdc/mem.c',
     64        'common/stdc/bsearch.c',
     65        'common/stdc/qsort.c',
     66        'common/stdc/calloc.c',
     67
    6468        'generic/libc.c',
    6569        'generic/as.c',
     
    160164        'generic/stats.c',
    161165        'generic/assert.c',
    162         'generic/bsearch.c',
    163         'generic/qsort.c',
    164166        'generic/ubsan.c',
    165167        'generic/uuid.c',
  • uspace/lib/posix/include/posix/stdlib.h

    rb169619 r44e8541  
    3737#define POSIX_STDLIB_H_
    3838
    39 #include <libc/stdlib.h>
     39#include <common/stdlib.h>
    4040#include <sys/types.h>
    4141
  • uspace/lib/posix/src/stdio.c

    rb169619 r44e8541  
    5555#include <io/printf_core.h>
    5656#include <str.h>
    57 #include <malloc.h>
     57#include <stdlib.h>
    5858#include <adt/list.h>
    5959
  • uspace/lib/posix/src/time.c

    rb169619 r44e8541  
    4747
    4848#include <fibril.h>
    49 #include <malloc.h>
     49#include <stdlib.h>
    5050#include <task.h>
    5151#include <stddef.h>
  • uspace/lib/posix/src/unistd.c

    rb169619 r44e8541  
    5050#include <task.h>
    5151#include <stats.h>
    52 #include <malloc.h>
     52#include <stdlib.h>
    5353#include <vfs/vfs.h>
    5454
Note: See TracChangeset for help on using the changeset viewer.