Changeset 34120f10 in mainline for uspace/lib


Ignore:
Timestamp:
2023-10-27T19:38:31Z (2 years 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
Files:
2 added
3 deleted
14 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',
  • uspace/lib/posix/include/posix/ctype.h

    rc89ae25 r34120f10  
    3737#define POSIX_CTYPE_H_
    3838
    39 #include <libc/ctype.h>
     39#include <common/ctype.h>
    4040
    4141__C_DECLS_BEGIN;
  • uspace/lib/posix/include/posix/stdlib.h

    rc89ae25 r34120f10  
    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/include/posix/string.h

    rc89ae25 r34120f10  
    4646#include <stddef.h>
    4747
    48 #include <libc/mem.h>
     48#include <common/mem.h>
    4949
    5050#define _REALLY_WANT_STRING_H
  • uspace/lib/posix/src/stdio.c

    rc89ae25 r34120f10  
    5353#include <unistd.h>
    5454
    55 #include <io/printf_core.h>
     55#include <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

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

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