Changeset b7fd2a0 in mainline for uspace/lib/c/include/str.h


Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/str.h

    r36f0738 rb7fd2a0  
    5959extern wchar_t str_decode(const char *str, size_t *offset, size_t sz);
    6060extern wchar_t str_decode_reverse(const char *str, size_t *offset, size_t sz);
    61 extern int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
     61extern errno_t chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz);
    6262
    6363extern size_t str_size(const char *str);
     
    9393extern void str_append(char *dest, size_t size, const char *src);
    9494
    95 extern int spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n);
     95extern errno_t spascii_to_str(char *dest, size_t size, const uint8_t *src, size_t n);
    9696extern void wstr_to_str(char *dest, size_t size, const wchar_t *src);
    9797extern char *wstr_to_astr(const wchar_t *src);
    9898extern void str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
    9999extern wchar_t *str_to_awstr(const char *src);
    100 extern int utf16_to_str(char *dest, size_t size, const uint16_t *src);
    101 extern int str_to_utf16(uint16_t *dest, size_t dlen, const char *src);
     100extern errno_t utf16_to_str(char *dest, size_t size, const uint16_t *src);
     101extern errno_t str_to_utf16(uint16_t *dest, size_t dlen, const char *src);
    102102extern size_t utf16_wsize(const uint16_t *ustr);
    103103
     
    116116extern char *str_tok(char *, const char *, char **);
    117117
    118 extern int str_uint8_t(const char *, const char **, unsigned int, bool,
     118extern errno_t str_uint8_t(const char *, const char **, unsigned int, bool,
    119119    uint8_t *);
    120 extern int str_uint16_t(const char *, const char **, unsigned int, bool,
     120extern errno_t str_uint16_t(const char *, const char **, unsigned int, bool,
    121121    uint16_t *);
    122 extern int str_uint32_t(const char *, const char **, unsigned int, bool,
     122extern errno_t str_uint32_t(const char *, const char **, unsigned int, bool,
    123123    uint32_t *);
    124 extern int str_uint64_t(const char *, const char **, unsigned int, bool,
     124extern errno_t str_uint64_t(const char *, const char **, unsigned int, bool,
    125125    uint64_t *);
    126 extern int str_size_t(const char *, const char **, unsigned int, bool,
     126extern errno_t str_size_t(const char *, const char **, unsigned int, bool,
    127127    size_t *);
    128128
Note: See TracChangeset for help on using the changeset viewer.