[4/4] Fix musl build

Message ID 20230516182517.999918-4-bernd.kuhls@t-online.de
State New
Headers
Series [1/4] Fix musl build |

Commit Message

Bernd Kuhls May 16, 2023, 6:25 p.m. UTC
  malloc_trim is a GNU extension and therefore not present in non-glibc C
libraries such as musl. Wrapping this in an ifdef fixes musl builds.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 vdr.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/vdr.c b/vdr.c
index 0f426e61..bc4902de 100644
--- a/vdr.c
+++ b/vdr.c
@@ -1588,12 +1588,14 @@  int main(int argc, char *argv[])
               cSchedules::Cleanup();
               // Plugins housekeeping:
               PluginManager.Housekeeping();
+#if defined(__GLIBC__)
               // Memory cleanup:
               static time_t LastMemoryCleanup = 0;
               if ((Now - LastMemoryCleanup) > MEMCLEANUPDELTA) {
                  malloc_trim(0);
                  LastMemoryCleanup = Now;
                  }
+#endif
               }
            }