Skip to content

Commit

Permalink
Simplify kernel extension code setting up StructInitInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored and james-d-mitchell committed Jan 3, 2025
1 parent 521f28b commit 57c4182
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions src/digraphs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2274,34 +2274,13 @@ static Int InitLibrary(StructInitInfo* module) {
*F InitInfopl() . . . . . . . . . . . . . . . . . table of init functions
*/
static StructInitInfo module = {
#ifdef DIGRAPHSSTATIC
.type = MODULE_STATIC,
#else
.type = MODULE_DYNAMIC,
#endif
.type = MODULE_DYNAMIC,
.name = "digraphs",
.initKernel = InitKernel,
.initLibrary = InitLibrary,
.postRestore = 0};

#ifndef DIGRAPHSSTATIC
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#endif
StructInitInfo* Init__Dynamic(void) {
return &module;
}
};

StructInitInfo* Init__digraphs(void) {
extern StructInitInfo* Init__Dynamic(void); // prototype to avoid warnings
StructInitInfo* Init__Dynamic(void) {
return &module;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif

0 comments on commit 57c4182

Please sign in to comment.