Changeset fdfb24e in mainline for common


Ignore:
Timestamp:
2023-10-27T17:53:21Z (20 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
55c5cb05
Parents:
44e8541
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-27 17:38:24)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2023-10-27 17:53:21)
Message:

Deduplicate string related functions

Location:
common
Files:
7 moved

Legend:

Unmodified
Added
Removed
  • common/include/str.h

    r44e8541 rfdfb24e  
    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 */
  • common/str_error.c

    r44e8541 rfdfb24e  
    2828 */
    2929
     30#include <str_error.h>
     31
    3032#include <errno.h>
    31 #include <str.h>
     33#include <stddef.h>
     34
    3235
    3336/*
     
    6467        /*
    6568         * Just a dumb linear search.
    66          * There too few entries to warrant anything smarter.
     69         * There are too few entries to warrant anything smarter.
    6770         */
    6871
     
    8689        }
    8790
    88         return "(unknown)";
     91        return NULL;
    8992}
    9093
     
    97100        }
    98101
    99         return "Unknown error code";
     102        return NULL;
    100103}
  • common/strtol.c

    r44e8541 rfdfb24e  
    269269long strtol(const char *nptr, char **endptr, int base)
    270270{
     271#if !__STDC_HOSTED__
     272        errno_t errno;
     273#endif
     274
    271275        return _strtosigned(nptr, endptr, base, LONG_MIN, LONG_MAX, &errno, false);
    272276}
     
    287291unsigned long strtoul(const char *nptr, char **endptr, int base)
    288292{
     293#if !__STDC_HOSTED__
     294        errno_t errno;
     295#endif
     296
    289297        return _strtounsigned(nptr, endptr, base, ULONG_MAX, &errno, false);
    290298}
     
    292300long long strtoll(const char *nptr, char **endptr, int base)
    293301{
     302#if !__STDC_HOSTED__
     303        errno_t errno;
     304#endif
     305
    294306        return _strtosigned(nptr, endptr, base, LLONG_MIN, LLONG_MAX, &errno, false);
    295307}
     
    297309unsigned long long strtoull(const char *nptr, char **endptr, int base)
    298310{
     311#if !__STDC_HOSTED__
     312        errno_t errno;
     313#endif
     314
    299315        return _strtounsigned(nptr, endptr, base, ULLONG_MAX, &errno, false);
    300316}
     
    302318intmax_t strtoimax(const char *nptr, char **endptr, int base)
    303319{
     320#if !__STDC_HOSTED__
     321        errno_t errno;
     322#endif
     323
    304324        return _strtosigned(nptr, endptr, base, INTMAX_MIN, INTMAX_MAX, &errno, false);
    305325}
     
    307327uintmax_t strtoumax(const char *nptr, char **endptr, int base)
    308328{
     329#if !__STDC_HOSTED__
     330        errno_t errno;
     331#endif
     332
    309333        return _strtounsigned(nptr, endptr, base, UINTMAX_MAX, &errno, false);
    310334}
Note: See TracChangeset for help on using the changeset viewer.