From 24d3399fd571fe07a888100e12ae2d4eabd0c6d9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 17 Oct 2016 09:31:51 +1100 Subject: [PATCH] AP_Module: report loaded hooks on startup useful for debugging --- libraries/AP_Module/AP_Module.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Module/AP_Module.cpp b/libraries/AP_Module/AP_Module.cpp index 946f7feb10..e9609a6d3d 100644 --- a/libraries/AP_Module/AP_Module.cpp +++ b/libraries/AP_Module/AP_Module.cpp @@ -47,7 +47,7 @@ void AP_Module::module_scan(const char *path) printf("dlopen(%s) -> %s\n", path, dlerror()); return; } - bool found_hook = false; + uint8_t found_hooks = 0; for (uint16_t i=0; inext = hooks[i]; h->symbol = s; hooks[i] = h; - found_hook = true; + found_hooks++; } } - if (!found_hook) { + if (found_hooks == 0) { // we don't need this module dlclose(m); + } else { + printf("AP_Module: Loaded %u hooks from %s\n", (unsigned)found_hooks, path); } #endif }