Changeset 52f9c57 in mainline


Ignore:
Timestamp:
2012-12-22T22:39:19Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a6a9910
Parents:
6326155b
Message:

libs: Add ARRAY_SIZE macro to macros.h

Location:
uspace/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/macros.h

    r6326155b r52f9c57  
    4040#define abs(a)     ((a) >= 0 ? (a) : (-a))
    4141
     42#define ARRAY_SIZE(array)   (sizeof(array) / sizeof(array[0]))
    4243
    4344#define KiB2SIZE(kb)  ((kb) << 10)
  • uspace/lib/usb/src/usb.c

    r6326155b r52f9c57  
    3838#include <errno.h>
    3939#include <assert.h>
    40 
    41 #define ARR_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
     40#include <macros.h>
    4241
    4342static const char *str_speed[] = {
     
    7473const char *usb_str_transfer_type(usb_transfer_type_t t)
    7574{
    76         if (t >= ARR_SIZE(str_transfer_type)) {
     75        if (t >= ARRAY_SIZE(str_transfer_type)) {
    7776                return "invalid";
    7877        }
     
    8786const char *usb_str_transfer_type_short(usb_transfer_type_t t)
    8887{
    89         if (t >= ARR_SIZE(str_transfer_type_short)) {
     88        if (t >= ARRAY_SIZE(str_transfer_type_short)) {
    9089                return "invl";
    9190        }
     
    10099const char *usb_str_direction(usb_direction_t d)
    101100{
    102         if (d >= ARR_SIZE(str_direction)) {
     101        if (d >= ARRAY_SIZE(str_direction)) {
    103102                return "invalid";
    104103        }
     
    113112const char *usb_str_speed(usb_speed_t s)
    114113{
    115         if (s >= ARR_SIZE(str_speed)) {
     114        if (s >= ARRAY_SIZE(str_speed)) {
    116115                return "invalid";
    117116        }
Note: See TracChangeset for help on using the changeset viewer.