Changeset 33b8d024 in mainline for uspace/lib/drv


Ignore:
Timestamp:
2018-01-16T20:38:46Z (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:
2467b41
Parents:
d39c46e0
Message:

Remove const qualifier from the argument of free() and realloc(),
as well as in numerous other variables that hold ownership of memory.

By convention, a pointer that holds ownership is _never_ qualified by const.
This is reflected in the standard type signature of free() and realloc().
Allowing const pointers to hold ownership may seem superficially convenient,
but is actually quite confusing to experienced C programmers.

Location:
uspace/lib/drv
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/private/driver.h

    rd39c46e0 r33b8d024  
    5757       
    5858        /** Device name */
    59         const char *name;
     59        char *name;
    6060       
    6161        /** Driver-specific data associated with this device */
     
    8484       
    8585        /** Function name */
    86         const char *name;
     86        char *name;
    8787       
    8888        /** List of device ids for driver matching */
  • uspace/lib/drv/generic/remote_audio_mixer.c

    rd39c46e0 r33b8d024  
    9494 * @return Error code.
    9595 */
    96 errno_t audio_mixer_get_info(async_exch_t *exch, const char **name, unsigned *items)
     96errno_t audio_mixer_get_info(async_exch_t *exch, char **name, unsigned *items)
    9797{
    9898        if (!exch)
     
    131131 */
    132132errno_t audio_mixer_get_item_info(async_exch_t *exch, unsigned item,
    133     const char **name, unsigned *levels)
     133    char **name, unsigned *levels)
    134134{
    135135        if (!exch)
  • uspace/lib/drv/generic/remote_audio_pcm.c

    rd39c46e0 r33b8d024  
    184184 * @note Caller is responsible for freeing newly allocated memory.
    185185 */
    186 errno_t audio_pcm_get_info_str(audio_pcm_sess_t *sess, const char **name)
     186errno_t audio_pcm_get_info_str(audio_pcm_sess_t *sess, char **name)
    187187{
    188188        if (!name)
  • uspace/lib/drv/include/audio_mixer_iface.h

    rd39c46e0 r33b8d024  
    4343#include "ddf/driver.h"
    4444
    45 errno_t audio_mixer_get_info(async_exch_t *, const char **, unsigned *);
     45errno_t audio_mixer_get_info(async_exch_t *, char **, unsigned *);
    4646errno_t audio_mixer_get_item_info(async_exch_t *, unsigned,
    47     const char **, unsigned *);
     47    char **, unsigned *);
    4848errno_t audio_mixer_get_item_level(async_exch_t *, unsigned, unsigned *);
    4949errno_t audio_mixer_set_item_level(async_exch_t *, unsigned, unsigned);
  • uspace/lib/drv/include/audio_pcm_iface.h

    rd39c46e0 r33b8d024  
    8080void audio_pcm_close(audio_pcm_sess_t *);
    8181
    82 errno_t audio_pcm_get_info_str(audio_pcm_sess_t *, const char **);
     82errno_t audio_pcm_get_info_str(audio_pcm_sess_t *, char **);
    8383errno_t audio_pcm_test_format(audio_pcm_sess_t *, unsigned *, unsigned *,
    8484    pcm_sample_format_t *);
Note: See TracChangeset for help on using the changeset viewer.