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


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 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/hostport.c

    r36f0738 rb7fd2a0  
    5656 *         extra characters at the end. ENOMEM if out of memory
    5757 */
    58 int inet_hostport_parse(const char *str, inet_hostport_t **rhp,
     58errno_t inet_hostport_parse(const char *str, inet_hostport_t **rhp,
    5959    char **endptr)
    6060{
     
    6565        char *aend;
    6666        const char *pend;
    67         int rc;
     67        errno_t rc;
    6868
    6969        hp = calloc(1, sizeof(inet_hostport_t));
     
    137137 * @return EOK on success, ENOMEM if out of memory
    138138 */
    139 int inet_hostport_format(inet_hostport_t *hp, char **rstr)
    140 {
    141         int rc;
     139errno_t inet_hostport_format(inet_hostport_t *hp, char **rstr)
     140{
     141        errno_t rc;
    142142        int ret;
    143143        char *astr, *str;
     
    211211 * @return EOK on success, ENOENT on resolution failure
    212212 */
    213 int inet_hostport_lookup_one(inet_hostport_t *hp, ip_ver_t version,
     213errno_t inet_hostport_lookup_one(inet_hostport_t *hp, ip_ver_t version,
    214214    inet_ep_t *ep)
    215215{
    216216        dnsr_hostinfo_t *hinfo = NULL;
    217         int rc;
     217        errno_t rc;
    218218
    219219        inet_ep_init(ep);
     
    255255 *         ENOMEM if out of memory
    256256 */
    257 int inet_hostport_plookup_one(const char *str, ip_ver_t version, inet_ep_t *ep,
     257errno_t inet_hostport_plookup_one(const char *str, ip_ver_t version, inet_ep_t *ep,
    258258    char **endptr, const char **errmsg)
    259259{
    260260        inet_hostport_t *hp = NULL;
    261261        char *eptr;
    262         int rc;
     262        errno_t rc;
    263263
    264264        rc = inet_hostport_parse(str, &hp, endptr != NULL ? &eptr : NULL);
Note: See TracChangeset for help on using the changeset viewer.