diff options
-rwxr-xr-x | solenv/bin/native-code.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index ebdba44a6aba..8bde580dda5a 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -638,15 +638,16 @@ for constructor in sorted(full_constructor_map.keys()): print ('') for entry in sorted(custom_widgets): print ('void make' + entry + '();') -print ('static struct { const char *name; void(*func)(); } custom_widgets[] = {') +print ('typedef void (*custom_widget_func)();') +print ('static struct { const char *name; custom_widget_func func; } custom_widgets[] = {') for entry in sorted(custom_widgets): print (' { "make' + entry + '", make' + entry + ' },') print ('};') print ('') print (""" -void (*lo_get_custom_widget_func(const char* name))() +custom_widget_func lo_get_custom_widget_func(const char* name) { - for (int i = 0; i < sizeof(custom_widgets) / sizeof(custom_widgets[0]); i++) + for (size_t i = 0; i < sizeof(custom_widgets) / sizeof(custom_widgets[0]); i++) if (strcmp(name, custom_widgets[i].name) == 0) return custom_widgets[i].func; return nullptr; |