From d54f23c0cc1ce0cefc0c2d6ed248e4c84a7444c4 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Thu, 13 Jun 2019 10:39:40 -0400 Subject: [PATCH] Deduplicated the common defer functions. --- test/events.c | 10 ---------- test/events_errors.c | 6 ------ test/main.c | 10 ++++++++++ test/test.h | 2 ++ 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/test/events.c b/test/events.c index 0aca304b..61b85742 100644 --- a/test/events.c +++ b/test/events.c @@ -160,16 +160,6 @@ static void runGlobalSubtests(testingT *t, void *data) testingTRun(t, "Nonglobal", runArgsSubtests, data); } -static void deferFree(testingT *t, void *data) -{ - free(data); -} - -static void deferEventFree(testingT *t, void *data) -{ - uiEventFree((uiEvent *) data); -} - static void deferUnregisterHandler(testingT *t, void *data) { unregisterHandler((struct handler *) data); diff --git a/test/events_errors.c b/test/events_errors.c index d41feab1..8e737524 100644 --- a/test/events_errors.c +++ b/test/events_errors.c @@ -6,12 +6,6 @@ static void dummyHandler(void *sender, void *args, void *data) // do nothing } -// TODO deduplicate this with events.c -static void deferEventFree(testingT *t, void *data) -{ - uiEventFree((uiEvent *) data); -} - struct checkEventErrorsParams { uiEvent *globalEvent; uiEvent *nonglobalEvent; diff --git a/test/main.c b/test/main.c index f369f4df..f2b811cd 100644 --- a/test/main.c +++ b/test/main.c @@ -6,6 +6,16 @@ void timeoutMain(void *data) uiMain(); } +void deferFree(testingT *t, void *data) +{ + free(data); +} + +void deferEventFree(testingT *t, void *data) +{ + uiEventFree((uiEvent *) data); +} + static void runSetORingResults(testingSet *set, const struct testingOptions *options, bool *anyRun, bool *anyFailed) { bool ar, af; diff --git a/test/test.h b/test/test.h index 81914a28..f203714e 100644 --- a/test/test.h +++ b/test/test.h @@ -29,6 +29,8 @@ extern void timeoutMain(void *data); testingTErrorf(t, "uiMain() timed out (%s)", timeoutstr); \ } \ } +extern void deferFree(testingT *t, void *data); +extern void deferEventFree(testingT *t, void *data); // init.c extern testingSet *beforeTests;