Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 365f259 in mainline


Ignore:
Timestamp:
2013-03-03T17:14:26Z (9 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
90c1d80
Parents:
80d5307
Message:

sb16: Use arrays_size macro.

Location:
uspace/drv/audio/sb16
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/sb16/dsp.c

    r80d5307 r365f259  
    4040#include <libarch/ddi.h>
    4141#include <libarch/barrier.h>
     42#include <macros.h>
    4243#include <str_error.h>
    4344#include <audio_pcm_iface.h>
     
    7475                [DSP_NO_BUFFER] = "NO BUFFER",
    7576        };
    76         if (state < (sizeof(state_names) / sizeof(state_names[0])))
     77        if (state < ARRAY_SIZE(state_names))
    7778                return state_names[state];
    7879        return "UNKNOWN";
  • uspace/drv/audio/sb16/mixer.c

    r80d5307 r365f259  
    3131#include <errno.h>
    3232#include <libarch/ddi.h>
     33#include <macros.h>
    3334#include <unistd.h>
    3435
     
    128129
    129130static const struct {
     131        const volume_item_t *table;
    130132        size_t count;
    131         const volume_item_t *table;
    132133} volume_table[] = {
    133         [SB_MIXER_NONE] = { 0, NULL },
    134         [SB_MIXER_UNKNOWN] = { 0, NULL },
    135         [SB_MIXER_CT1335] = {
    136             sizeof(volume_ct1335) / sizeof(volume_item_t), volume_ct1335 },
    137         [SB_MIXER_CT1345] = {
    138             sizeof(volume_ct1345) / sizeof(volume_item_t), volume_ct1345 },
    139         [SB_MIXER_CT1745] = {
    140             sizeof(volume_ct1745) / sizeof(volume_item_t), volume_ct1745 },
     134        [SB_MIXER_NONE] = { NULL, 0 },
     135        [SB_MIXER_UNKNOWN] = { NULL, 0 },
     136        [SB_MIXER_CT1335] = { volume_ct1335, ARRAY_SIZE(volume_ct1335) },
     137        [SB_MIXER_CT1345] = { volume_ct1345, ARRAY_SIZE(volume_ct1345) },
     138        [SB_MIXER_CT1745] = { volume_ct1745, ARRAY_SIZE(volume_ct1745) },
    141139};
    142140
    143141const char * sb_mixer_type_str(sb_mixer_type_t type)
    144142{
    145         static const char * names[] = {
     143        static const char *names[] = {
     144                [SB_MIXER_NONE] = "No mixer",
    146145                [SB_MIXER_CT1335] = "CT 1335",
    147146                [SB_MIXER_CT1345] = "CT 1345",
  • uspace/drv/audio/sb16/sb16.c

    r80d5307 r365f259  
    3131#include <errno.h>
    3232#include <str_error.h>
     33#include <macros.h>
    3334#include <audio_mixer_iface.h>
    3435#include <audio_pcm_iface.h>
     
    7374size_t sb16_irq_code_size(void)
    7475{
    75         return sizeof(irq_cmds) / sizeof(irq_cmds[0]);
     76        return ARRAY_SIZE(irq_cmds);
    7677}
    7778
Note: See TracChangeset for help on using the changeset viewer.