Code cleanup: remove redundant arg from ARRAY_LAST_ITEM

This commit is contained in:
Campbell Barton
2014-05-29 13:38:34 +10:00
parent c3c04fe582
commit 1962e21703
2 changed files with 15 additions and 6 deletions

View File

@@ -469,7 +469,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple
}
/* find last selected */
bezt = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, sizeof(BezTriple), fcu->totvert);
bezt = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, fcu->totvert);
for (i = 0; i < fcu->totvert; bezt--, i++) {
if (BEZSELECTED(bezt)) {
*last = bezt;
@@ -481,7 +481,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple
else {
/* just full array */
*first = fcu->bezt;
*last = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, sizeof(BezTriple), fcu->totvert);
*last = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, fcu->totvert);
found = true;
}

View File

@@ -147,9 +147,17 @@
__tmp = (__typeof(var_b) *)NULL; \
(void)__tmp; \
} (void)0
#define CHECK_TYPE_PAIR_INLINE(var_a, var_b) ((void)({ \
__typeof(var_a) *__tmp; \
__tmp = (__typeof(var_b) *)NULL; \
(void)__tmp; \
}))
#else
# define CHECK_TYPE(var, type)
# define CHECK_TYPE_PAIR(var_a, var_b)
# define CHECK_TYPE_PAIR_INLINE(var_a, var_b)
#endif
/* can be used in simple macros */
@@ -348,11 +356,12 @@
#endif
/* array helpers */
#define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) \
(arr_dtype *)((char *)arr_start + (elem_size * (tot - 1)))
#define ARRAY_LAST_ITEM(arr_start, arr_dtype, tot) \
(arr_dtype *)((char *)arr_start + (sizeof(*((arr_dtype *)NULL)) * (size_t)(tot - 1)))
#define ARRAY_HAS_ITEM(arr_item, arr_start, tot) \
((unsigned int)((arr_item) - (arr_start)) < (unsigned int)(tot))
#define ARRAY_HAS_ITEM(arr_item, arr_start, tot) ( \
CHECK_TYPE_PAIR_INLINE(arr_start, arr_item), \
((unsigned int)((arr_item) - (arr_start)) < (unsigned int)(tot)))
#define ARRAY_DELETE(arr, index, tot_delete, tot) { \
BLI_assert(index + tot_delete <= tot); \