• Blue Swirl's avatar
    Use ARRAY_SIZE macro · 66fe09ee
    Blue Swirl authored
    Replace array size calculations with ARRAY_SIZE macro.
    
    Implemented with this Coccinelle semantic patch, adapted from
    Linux kernel:
    @@
    type T;
    T[] E;
    @@
    
    - (sizeof(E)/sizeof(*E))
    + ARRAY_SIZE(E)
    
    @@
    type T;
    T[] E;
    @@
    
    - (sizeof(E)/sizeof(E[...]))
    + ARRAY_SIZE(E)
    
    @@
    type T;
    T[] E;
    @@
    
    - (sizeof(E)/sizeof(T))
    + ARRAY_SIZE(E)
    
    Some files (*-dis.c, tests/*) had to be filtered out.
    Signed-off-by: default avatarBlue Swirl <blauwirbel@gmail.com>
    66fe09ee
os-posix.c 7.59 KB