Changeset b7fd2a0 in mainline for uspace/lib/c/generic/inet/host.c


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/generic/inet/host.c

    r36f0738 rb7fd2a0  
    5454 *         extra characters at the end. ENOMEM if out of memory
    5555 */
    56 int inet_host_parse(const char *str, inet_host_t **rhost,
     56errno_t inet_host_parse(const char *str, inet_host_t **rhost,
    5757    char **endptr)
    5858{
     
    6161        char *name;
    6262        char *aend;
    63         int rc;
     63        errno_t rc;
    6464
    6565        host = calloc(1, sizeof(inet_host_t));
     
    106106 * @return EOK on success, ENOMEM if out of memory
    107107 */
    108 int inet_host_format(inet_host_t *host, char **rstr)
    109 {
    110         int rc;
     108errno_t inet_host_format(inet_host_t *host, char **rstr)
     109{
     110        errno_t rc;
    111111        char *str = NULL;
    112112
     
    161161 * @reutrn EOK on success, ENOENT on resolurion failure
    162162 */
    163 int inet_host_lookup_one(inet_host_t *host, ip_ver_t version, inet_addr_t *addr)
     163errno_t inet_host_lookup_one(inet_host_t *host, ip_ver_t version, inet_addr_t *addr)
    164164{
    165165        dnsr_hostinfo_t *hinfo = NULL;
    166         int rc;
     166        errno_t rc;
    167167
    168168        switch (host->hform) {
     
    201201 *         ENOMEM if out of memory
    202202 */
    203 int inet_host_plookup_one(const char *str, ip_ver_t version, inet_addr_t *addr,
     203errno_t inet_host_plookup_one(const char *str, ip_ver_t version, inet_addr_t *addr,
    204204    char **endptr, const char **errmsg)
    205205{
    206206        inet_host_t *host = NULL;
    207207        char *eptr;
    208         int rc;
     208        errno_t rc;
    209209
    210210        rc = inet_host_parse(str, &host, endptr != NULL ? &eptr : NULL);
Note: See TracChangeset for help on using the changeset viewer.