Wrap memmove in glfw with a nice safe macro
This commit is contained in:
parent
857a53e80f
commit
3c7a71772c
@ -516,10 +516,7 @@ remove_timer_at(size_t idx) {
|
||||
Timer *t = timers + idx;
|
||||
if (t->os_timer) { [t->os_timer invalidate]; t->os_timer = NULL; }
|
||||
if (t->callback_data && t->free_callback_data) { t->free_callback_data(t->id, t->callback_data); t->callback_data = NULL; }
|
||||
num_timers--;
|
||||
if (idx < num_timers) {
|
||||
memmove(timers + idx, timers + idx + 1, sizeof(timers[0]) * (num_timers - idx));
|
||||
}
|
||||
remove_i_from_array(timers, idx, num_timers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6
glfw/internal.h
vendored
6
glfw/internal.h
vendored
@ -196,6 +196,12 @@ typedef void (APIENTRY * PFN_vkVoidFunction)(void);
|
||||
#error "No supported window creation API selected"
|
||||
#endif
|
||||
|
||||
#define remove_i_from_array(array, i, count) { \
|
||||
count--; \
|
||||
if (i < count) { \
|
||||
memmove(array + i, array + i + 1, sizeof(array[0]) * (count - 1)); \
|
||||
}}
|
||||
|
||||
// Constructs a version number string from the public header macros
|
||||
#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r
|
||||
#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r)
|
||||
|
||||
5
glfw/monitor.c
vendored
5
glfw/monitor.c
vendored
@ -127,10 +127,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement)
|
||||
{
|
||||
if (_glfw.monitors[i] == monitor)
|
||||
{
|
||||
_glfw.monitorCount--;
|
||||
memmove(_glfw.monitors + i,
|
||||
_glfw.monitors + i + 1,
|
||||
(_glfw.monitorCount - i) * sizeof(_GLFWmonitor*));
|
||||
remove_i_from_array(_glfw.monitors, i, _glfw.monitorCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user