]> git.sesse.net Git - vlc/commit
Remove variable name clashes in TAB_REMOVE
authorRafaël Carré <funman@videolan.org>
Mon, 17 Dec 2012 00:00:29 +0000 (01:00 +0100)
committerRafaël Carré <funman@videolan.org>
Mon, 17 Dec 2012 00:00:29 +0000 (01:00 +0100)
commit728ef39d15cdbfc5b1bc9beba8a97493ef6c08fc
tree1efd33e84963d354b56ba7f54fbe3aa0436fb5de
parent22188d37f99be2452faffccc0864ed1f2eb41e1a
Remove variable name clashes in TAB_REMOVE

If foo[i] or bar[i_index] are used in TAB_REMOVE / TAB_FIND, they will
use another variable with local scope declared inside the macro.

for (int i = 0; i < 1; i++) {
    TAB_REMOVE( count, array, foo[i] );
}

will expand to:

for (int i = 0; i < 1; i++) {
    int i_index;
    .....
    for (int i = 0; i < count; i++)
        if (array[i] == foo[i])
        {
            index = i;
            break;
        }
    .....
}

And inner scope i is used to index foo, instead of the outer scope i
which we would expect without knowing the content of the macro.
modules/demux/ts.c
modules/misc/rtsp.c
src/input/vlmshell.c