Changeset 34120f10 in mainline for common/include


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:
common/include
Files:
19 moved

Legend:

Unmodified
Added
Removed
  • common/include/adt/hash.h

    rc89ae25 r34120f10  
    3535#define _LIBC_ADT_HASH_H_
    3636
     37#include <stddef.h>
    3738#include <stdint.h>
    38 #include <types/common.h>
    3939
    4040/** Produces a uniform hash affecting all output bits from the skewed input. */
     
    7878static inline size_t hash_mix(size_t hash)
    7979{
    80 #ifdef __32_BITS__
    81         return hash_mix32(hash);
    82 #elif defined(__64_BITS__)
    83         return hash_mix64(hash);
    84 #else
    85 #error Unknown size_t size - cannot select proper hash mix function.
    86 #endif
     80        if (sizeof(long) == 4)
     81                return hash_mix32(hash);
     82        else
     83                return hash_mix64(hash);
    8784}
    8885
  • common/include/mem.h

    rc89ae25 r34120f10  
    5555__C_DECLS_END;
    5656
     57#if !__STDC_HOSTED__
     58#define memset(dst, val, cnt)  __builtin_memset((dst), (val), (cnt))
     59#define memcpy(dst, src, cnt)  __builtin_memcpy((dst), (src), (cnt))
     60#define memcmp(s1, s2, cnt)    __builtin_memcmp((s1), (s2), (cnt))
     61#define memmove(dst, src, cnt)  __builtin_memmove((dst), (src), (cnt))
     62#define memchr(s, c, cnt)  __builtin_memchr((s), (c), (cnt))
     63#endif
     64
    5765#endif
    5866
  • common/include/stdlib.h

    rc89ae25 r34120f10  
    4141#include <_bits/decls.h>
    4242#include <bsearch.h>
    43 #include <malloc.h>
    4443#include <qsort.h>
    4544
     
    109108extern lldiv_t lldiv(long long, long long);
    110109
     110extern void *malloc(size_t size)
     111    __attribute__((malloc));
     112extern void *calloc(size_t nmemb, size_t size)
     113    __attribute__((malloc));
     114extern void *realloc(void *addr, size_t size)
     115    __attribute__((warn_unused_result));
     116extern void free(void *addr);
     117
     118#ifdef _HELENOS_SOURCE
     119__HELENOS_DECLS_BEGIN;
     120
     121extern void *memalign(size_t align, size_t size)
     122    __attribute__((malloc));
     123
     124__HELENOS_DECLS_END;
     125#endif
     126
    111127__C_DECLS_END;
    112128
  • common/include/str.h

    rc89ae25 r34120f10  
    4545#include <mem.h>
    4646#include <_bits/decls.h>
     47#include <_bits/uchar.h>
    4748
    4849#ifndef __cplusplus
     
    5051/* Common Unicode characters */
    5152#define U_SPECIAL      '?'
     53
     54#define U_LEFT_ARROW   0x2190
     55#define U_UP_ARROW     0x2191
     56#define U_RIGHT_ARROW  0x2192
     57#define U_DOWN_ARROW   0x2193
     58
     59#define U_PAGE_UP      0x21de
     60#define U_PAGE_DOWN    0x21df
     61
     62#define U_HOME_ARROW   0x21f1
     63#define U_END_ARROW    0x21f2
     64
     65#define U_NULL         0x2400
     66#define U_ESCAPE       0x241b
     67#define U_DELETE       0x2421
     68
     69#define U_CURSOR       0x2588
    5270
    5371/** No size limit constant */
Note: See TracChangeset for help on using the changeset viewer.