Changeset b7fd2a0 in mainline for uspace/srv/hid/isdv4_tablet/isdv4.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/srv/hid/isdv4_tablet/isdv4.c

    r36f0738 rb7fd2a0  
    294294}
    295295
    296 static int read_packets(isdv4_state_t *state, packet_consumer_fn consumer)
     296static errno_t read_packets(isdv4_state_t *state, packet_consumer_fn consumer)
    297297{
    298298        bool reading = true;
    299299        while (reading) {
    300300                size_t nread;
    301                 int rc;
     301                errno_t rc;
    302302
    303303                rc = chardev_read(state->chardev, state->buf + state->buf_end,
     
    363363static bool write_command(chardev_t *chardev, uint8_t command)
    364364{
    365         int rc;
     365        errno_t rc;
    366366        size_t nwr;
    367367
     
    370370}
    371371
    372 int isdv4_init(isdv4_state_t *state, async_sess_t *sess,
     372errno_t isdv4_init(isdv4_state_t *state, async_sess_t *sess,
    373373    isdv4_event_fn event_fn)
    374374{
    375375        chardev_t *chardev;
    376         int rc;
     376        errno_t rc;
    377377
    378378        rc = chardev_open(sess, &chardev);
     
    396396}
    397397
    398 int isdv4_init_tablet(isdv4_state_t *state)
     398errno_t isdv4_init_tablet(isdv4_state_t *state)
    399399{
    400400        if (!write_command(state->chardev, CMD_STOP))
     
    407407                return EIO;
    408408
    409         int rc = read_packets(state, parse_response_stylus);
     409        errno_t rc = read_packets(state, parse_response_stylus);
    410410        if (rc != EOK)
    411411                return rc;
     
    424424}
    425425
    426 int isdv4_read_events(isdv4_state_t *state)
     426errno_t isdv4_read_events(isdv4_state_t *state)
    427427{
    428428        return read_packets(state, parse_event);
Note: See TracChangeset for help on using the changeset viewer.