Deduplicated the common defer functions.

This commit is contained in:
Pietro Gagliardi 2019-06-13 10:39:40 -04:00
parent f3b0dc16ab
commit d54f23c0cc
4 changed files with 12 additions and 16 deletions

View File

@ -160,16 +160,6 @@ static void runGlobalSubtests(testingT *t, void *data)
testingTRun(t, "Nonglobal", runArgsSubtests, 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) static void deferUnregisterHandler(testingT *t, void *data)
{ {
unregisterHandler((struct handler *) data); unregisterHandler((struct handler *) data);

View File

@ -6,12 +6,6 @@ static void dummyHandler(void *sender, void *args, void *data)
// do nothing // do nothing
} }
// TODO deduplicate this with events.c
static void deferEventFree(testingT *t, void *data)
{
uiEventFree((uiEvent *) data);
}
struct checkEventErrorsParams { struct checkEventErrorsParams {
uiEvent *globalEvent; uiEvent *globalEvent;
uiEvent *nonglobalEvent; uiEvent *nonglobalEvent;

View File

@ -6,6 +6,16 @@ void timeoutMain(void *data)
uiMain(); 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) static void runSetORingResults(testingSet *set, const struct testingOptions *options, bool *anyRun, bool *anyFailed)
{ {
bool ar, af; bool ar, af;

View File

@ -29,6 +29,8 @@ extern void timeoutMain(void *data);
testingTErrorf(t, "uiMain() timed out (%s)", timeoutstr); \ testingTErrorf(t, "uiMain() timed out (%s)", timeoutstr); \
} \ } \
} }
extern void deferFree(testingT *t, void *data);
extern void deferEventFree(testingT *t, void *data);
// init.c // init.c
extern testingSet *beforeTests; extern testingSet *beforeTests;