Make 'rb_get_args()' va_arg passing safer by introducing a termination marker

What can I say. I made a pact with the devil, and paid dearly.
Almost a whole day's worth of debugging, actually. Not again.

If this turns out to be slow we can always optimize the critical
parts (with no variable param count) later, or completely remove it.
This commit is contained in:
Jonas Kulla 2013-09-27 04:49:48 +02:00
parent 92525cd077
commit 4ff563725b
15 changed files with 92 additions and 48 deletions

View file

@ -38,7 +38,7 @@ RB_METHOD(inputPress)
RB_UNUSED_PARAM;
int num;
rb_get_args(argc, argv, "i", &num);
rb_get_args(argc, argv, "i", &num, RB_ARG_END);
Input::ButtonCode bc = (Input::ButtonCode) num;
@ -50,7 +50,7 @@ RB_METHOD(inputTrigger)
RB_UNUSED_PARAM;
int num;
rb_get_args(argc, argv, "i", &num);
rb_get_args(argc, argv, "i", &num, RB_ARG_END);
Input::ButtonCode bc = (Input::ButtonCode) num;
@ -62,7 +62,7 @@ RB_METHOD(inputRepeat)
RB_UNUSED_PARAM;
int num;
rb_get_args(argc, argv, "i", &num);
rb_get_args(argc, argv, "i", &num, RB_ARG_END);
Input::ButtonCode bc = (Input::ButtonCode) num;