[gnome-software: 1/2] gs-shell: only call malloc_trim with glibc




commit 3eb1a37b373072dbcef755606edc53e605c582f0
Author: Dylan Van Assche <me dylanvanassche be>
Date:   Mon May 2 20:54:00 2022 +0200

    gs-shell: only call malloc_trim with glibc
    
    malloc_trim is a GNU extension and therefore not present in non-glibc
    C libraries such as musl. Wrapping this in an ifdef allows GNOME Software
    to be compiled again on musl.

 src/gs-shell.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index ff2a142ed..db449a9b0 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1078,8 +1078,10 @@ main_window_closed_cb (GtkWidget *dialog, gpointer user_data)
        gs_shell_clean_back_entry_stack (shell);
        gtk_widget_hide (dialog);
 
-       /* Free unused memory */
+#ifdef __GLIBC__
+       /* Free unused memory with GNU extension of malloc.h */
        malloc_trim (0);
+#endif
 
        return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]