From 82108808f13d056b3904c1717658a306a4aba2dd Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 25 Dec 2018 16:44:19 +0100 Subject: Switch to modern realpath() Assume everywhere that the realpath() implementation has the POSIX.1-2008 behaviour, i.e. allowing NULL as second parameter and thus returning a newly allocated buffer; it is not just a GNU extension, and supported already by modern libc's on other OSes. menu_canonicalize_file_name() is always called with FALSE as second parameter, so it is replaced directly by realpath(); this allows the complete removal of canonicalize.{c,h}. This is a forward-port of the same changes done in gnome-menus, see: https://gitlab.gnome.org/GNOME/gnome-menus/merge_requests/4 --- libmenu/matemenu-tree.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libmenu/matemenu-tree.c') diff --git a/libmenu/matemenu-tree.c b/libmenu/matemenu-tree.c index 4ce4d55..f65a2be 100644 --- a/libmenu/matemenu-tree.c +++ b/libmenu/matemenu-tree.c @@ -24,11 +24,11 @@ #include #include #include +#include #include "menu-layout.h" #include "menu-monitor.h" #include "menu-util.h" -#include "canonicalize.h" /* private */ typedef struct MateMenuTreeItem MateMenuTreeItem; @@ -333,7 +333,7 @@ static gboolean canonicalize_path (MateMenuTree *tree, const char *path) { - tree->canonical_path = menu_canonicalize_file_name (path, FALSE); + tree->canonical_path = realpath (path, NULL); if (tree->canonical_path) { tree->canonical = TRUE; @@ -1887,7 +1887,7 @@ load_merge_file (MateMenuTree *tree, if (!is_canonical) { - canonical = freeme = menu_canonicalize_file_name (filename, FALSE); + canonical = freeme = realpath (filename, NULL); if (canonical == NULL) { if (add_monitor) @@ -1982,7 +1982,7 @@ compare_basedir_to_config_dir (const char *canonical_basedir, retval = FALSE; - canonical_menus_dir = menu_canonicalize_file_name (dirname, FALSE); + canonical_menus_dir = realpath (dirname, NULL); if (canonical_menus_dir != NULL && strcmp (canonical_basedir, canonical_menus_dir) == 0) { @@ -2056,7 +2056,7 @@ static gboolean load_parent_merge_file(MateMenuTree* tree, GHashTable* loaded_me basedir = menu_layout_node_root_get_basedir(root); menu_name = menu_layout_node_root_get_name(root); - canonical_basedir = menu_canonicalize_file_name(basedir, FALSE); + canonical_basedir = realpath (basedir, NULL); if (canonical_basedir == NULL) { -- cgit v1.2.1