summaryrefslogtreecommitdiff
path: root/libmenu/matemenu-tree.c
diff options
context:
space:
mode:
authorPino Toscano <[email protected]>2018-12-25 16:44:19 +0100
committerraveit65 <[email protected]>2018-12-30 11:38:27 +0100
commit82108808f13d056b3904c1717658a306a4aba2dd (patch)
treeb9280444bbef3c1c14ef2e7ce2d96edc3afbb337 /libmenu/matemenu-tree.c
parent96505c413183f8569fbb45c5d39cfcb7a95598cd (diff)
downloadmate-menus-82108808f13d056b3904c1717658a306a4aba2dd.tar.bz2
mate-menus-82108808f13d056b3904c1717658a306a4aba2dd.tar.xz
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
Diffstat (limited to 'libmenu/matemenu-tree.c')
-rw-r--r--libmenu/matemenu-tree.c10
1 files changed, 5 insertions, 5 deletions
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 <gio/gio.h>
#include <string.h>
#include <errno.h>
+#include <stdlib.h>
#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)
{