Changeset 34120f10 in mainline for uspace/lib/c


Ignore:
Timestamp:
2023-10-27T19:38:31Z (21 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.

Location:
uspace/lib/c
Files:
1 added
3 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/asprintf.c

    rc89ae25 r34120f10  
    3939#include <stddef.h>
    4040#include <str.h>
    41 #include <io/printf_core.h>
     41#include <printf_core.h>
    4242
    4343static int asprintf_str_write(const char *str, size_t count, void *unused)
  • uspace/lib/c/generic/io/kio.c

    rc89ae25 r34120f10  
    4242#include <abi/kio.h>
    4343#include <io/kio.h>
    44 #include <io/printf_core.h>
     44#include <printf_core.h>
    4545#include <macros.h>
    4646#include <libarch/config.h>
  • uspace/lib/c/generic/io/printf.c

    rc89ae25 r34120f10  
    3333 */
    3434
    35 #include <io/printf_core.h>
     35#include <printf_core.h>
    3636#include <stdio.h>
    3737
  • uspace/lib/c/generic/io/vprintf.c

    rc89ae25 r34120f10  
    3535#include <stdarg.h>
    3636#include <stdio.h>
    37 #include <io/printf_core.h>
     37#include <printf_core.h>
    3838#include <fibril_synch.h>
    3939#include <async.h>
  • uspace/lib/c/generic/io/vsnprintf.c

    rc89ae25 r34120f10  
    3636#include <stdio.h>
    3737#include <str.h>
    38 #include <io/printf_core.h>
     38#include <printf_core.h>
    3939#include <errno.h>
    4040
  • 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 *
  • uspace/lib/c/include/malloc.h

    rc89ae25 r34120f10  
    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

    rc89ae25 r34120f10  
    4242        root_path / 'abi' / 'arch' / UARCH / 'include',
    4343        root_path / 'abi' / 'include',
     44        root_path / 'common' / 'include',
    4445]
    4546
     
    6061
    6162src += files(
     63        'common/adt/checksum.c',
     64        'common/adt/circ_buf.c',
     65        'common/adt/list.c',
     66        'common/adt/hash_table.c',
     67        'common/adt/odict.c',
     68        'common/adt/prodcons.c',
     69        'common/printf/printf_core.c',
     70        'common/stdc/ctype.c',
     71        'common/stdc/mem.c',
     72        'common/stdc/bsearch.c',
     73        'common/stdc/qsort.c',
     74        'common/stdc/calloc.c',
     75        'common/gsort.c',
     76        'common/str.c',
     77        'common/str_error.c',
     78        'common/strtol.c',
     79
    6280        'generic/libc.c',
    6381        'generic/as.c',
     
    6987        'generic/context.c',
    7088        'generic/corecfg.c',
    71         'generic/ctype.c',
    7289        'generic/device/clock_dev.c',
    7390        'generic/device/hw_res.c',
     
    8198        'generic/event.c',
    8299        'generic/errno.c',
    83         'generic/gsort.c',
    84100        'generic/inttypes.c',
    85101        'generic/ipc_test.c',
    86102        'generic/loc.c',
    87         'generic/mem.c',
    88         'generic/str.c',
    89103        'generic/string.c',
    90         'generic/str_error.c',
    91         'generic/strtol.c',
    92104        'generic/l18n/langs.c',
    93105        'generic/pcb.c',
     
    109121        'generic/io/vprintf.c',
    110122        'generic/io/vsnprintf.c',
    111         'generic/io/printf_core.c',
    112123        'generic/io/con_srv.c',
    113124        'generic/io/console.c',
     
    138149        'generic/loader.c',
    139150        'generic/getopt.c',
    140         'generic/adt/checksum.c',
    141         'generic/adt/circ_buf.c',
    142         'generic/adt/list.c',
    143         'generic/adt/hash_table.c',
    144         'generic/adt/odict.c',
    145         'generic/adt/prodcons.c',
    146151        'generic/time.c',
    147152        'generic/tmpfile.c',
     
    159164        'generic/stats.c',
    160165        'generic/assert.c',
    161         'generic/bsearch.c',
    162         'generic/qsort.c',
    163166        'generic/ubsan.c',
    164167        'generic/uuid.c',
Note: See TracChangeset for help on using the changeset viewer.