Changeset b7fd2a0 in mainline for uspace/srv/audio/hound/iface.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/audio/hound/iface.c

    r36f0738 rb7fd2a0  
    4343#include "log.h"
    4444
    45 static int iface_add_context(void *server, hound_context_id_t *id,
     45static errno_t iface_add_context(void *server, hound_context_id_t *id,
    4646    const char *name, bool record)
    4747{
     
    5555                return ENOMEM;
    5656
    57         const int ret = hound_add_ctx(server, ctx);
     57        const errno_t ret = hound_add_ctx(server, ctx);
    5858        if (ret != EOK)
    5959                hound_ctx_destroy(ctx);
     
    6363}
    6464
    65 static int iface_rem_context(void *server, hound_context_id_t id)
     65static errno_t iface_rem_context(void *server, hound_context_id_t id)
    6666{
    6767        assert(server);
     
    6969        if (!ctx)
    7070                return EINVAL;
    71         const int ret = hound_remove_ctx(server, ctx);
     71        const errno_t ret = hound_remove_ctx(server, ctx);
    7272        if (ret == EOK) {
    7373                hound_ctx_destroy(ctx);
     
    8686}
    8787
    88 static int iface_get_list(void *server, const char ***list, size_t *size,
     88static errno_t iface_get_list(void *server, const char ***list, size_t *size,
    8989    const char *connection, int flags)
    9090{
     
    9898}
    9999
    100 static int iface_connect(void *server, const char *source, const char *sink)
     100static errno_t iface_connect(void *server, const char *source, const char *sink)
    101101{
    102102        log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
     
    104104}
    105105
    106 static int iface_disconnect(void *server, const char *source, const char *sink)
     106static errno_t iface_disconnect(void *server, const char *source, const char *sink)
    107107{
    108108        log_info("%s: %p, %s -> %s", __FUNCTION__, server, source, sink);
     
    110110}
    111111
    112 static int iface_add_stream(void *server, hound_context_id_t id, int flags,
     112static errno_t iface_add_stream(void *server, hound_context_id_t id, int flags,
    113113    pcm_format_t format, size_t size, void **data)
    114114{
     
    130130}
    131131
    132 static int iface_rem_stream(void *server, void *stream)
     132static errno_t iface_rem_stream(void *server, void *stream)
    133133{
    134134        hound_ctx_destroy_stream(stream);
     
    136136}
    137137
    138 static int iface_drain_stream(void *stream)
     138static errno_t iface_drain_stream(void *stream)
    139139{
    140140        hound_ctx_stream_drain(stream);
     
    142142}
    143143
    144 static int iface_stream_data_read(void *stream, void *buffer, size_t size)
     144static errno_t iface_stream_data_read(void *stream, void *buffer, size_t size)
    145145{
    146146        return hound_ctx_stream_read(stream, buffer, size);
    147147}
    148148
    149 static int iface_stream_data_write(void *stream, const void *buffer, size_t size)
     149static errno_t iface_stream_data_write(void *stream, const void *buffer, size_t size)
    150150{
    151151        return hound_ctx_stream_write(stream, buffer, size);
Note: See TracChangeset for help on using the changeset viewer.