Description: Don't use PATH_MAX for portability reasons
 Use dynamic allocation instead. Fixes FTBFS on GNU/Hurd.
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=617416
Author: Emilio Pozuelo Monfort <pochu@debian.org>
Last-Update: 2010-05-02

--- a/bin/editor.c
+++ b/bin/editor.c
@@ -47,9 +47,6 @@
 #include "editor.h"
 
 #ifdef G_OS_WIN32
-#ifndef PATH_MAX
-#define PATH_MAX _MAX_PATH
-#endif
 #define realpath(a,b) _fullpath(b,a,_MAX_PATH)
 #endif
 
@@ -2947,9 +2944,10 @@
                                         "/home/pippin/media/video/", NULL);
 
   {
-    gchar absolute_path[PATH_MAX];
-    realpath (editor.options->file, absolute_path);
+    gchar* absolute_path;
+    absolute_path = realpath (editor.options->file, NULL);
     gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), absolute_path);
+    free (absolute_path);
   }
 
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
@@ -2961,7 +2959,7 @@
       if (filename)
         {
           gchar *full_filename;
-          gchar  abs_filepath[PATH_MAX];
+          gchar *abs_filepath;
           gchar *abs_path;
           gchar *xml;
 
@@ -2982,8 +2980,9 @@
           editor.options->file = g_strdup (full_filename);
           */
 
-          realpath (full_filename, abs_filepath);
+          abs_filepath = realpath (full_filename, NULL);
           abs_path = g_strdup (g_path_get_dirname (abs_filepath));
+          free (abs_filepath);
           xml = gegl_node_to_xml (editor.gegl, abs_path); /*oxide_xml (editor->oxide, abs_path);*/
 
           g_file_set_contents (full_filename, xml, -1, NULL);
--- a/bin/gegl.c
+++ b/bin/gegl.c
@@ -36,9 +36,6 @@
 #ifdef G_OS_WIN32
 #include <direct.h>
 #define getcwd(b,n) _getcwd(b,n)
-#ifndef PATH_MAX
-#define PATH_MAX _MAX_PATH
-#endif
 #define realpath(a,b) _fullpath(b,a,_MAX_PATH)
 #endif
 
@@ -105,24 +102,21 @@
 
   if (o->xml)
     {
-      gchar *tmp = g_malloc(PATH_MAX);
-      tmp = getcwd (tmp, PATH_MAX);
-      path_root = tmp;
+      path_root = g_get_current_dir ();
     }
   else if (o->file)
     {
       if (!strcmp (o->file, "-"))  /* read XML from stdin */
         {
-          gchar *tmp = g_malloc(PATH_MAX);
-          tmp = getcwd (tmp, PATH_MAX);
-          path_root = tmp;
+          path_root = g_get_current_dir ();
         }
       else
         {
-          gchar real_path[PATH_MAX];
+          gchar *tmp;
           gchar *temp1 = g_strdup (o->file);
           gchar *temp2 = g_path_get_dirname (temp1);
-          path_root = g_strdup (realpath (temp2, real_path));
+          path_root = g_strdup (tmp = realpath (temp2, NULL));
+          free (tmp);
           g_free (temp1);
           g_free (temp2);
         }
--- a/gegl/gegl-xml.c
+++ b/gegl/gegl-xml.c
@@ -37,9 +37,6 @@
 #include "gegl-xml.h"
 
 #ifdef G_OS_WIN32
-#ifndef PATH_MAX
-#define PATH_MAX _MAX_PATH
-#endif
 #define realpath(a, b)    _fullpath (b, a, _MAX_PATH)
 #endif
 
@@ -121,7 +118,7 @@
       else if (g_type_is_a (G_PARAM_SPEC_TYPE (paramspec),
                             GEGL_TYPE_PARAM_FILE_PATH))
         {
-          gchar buf[PATH_MAX];
+          gchar *buf;
 
           if (g_path_is_absolute (param_value))
             {
@@ -129,18 +126,21 @@
             }
           else if (pd->path_root)
             {
-              gchar absolute_path[PATH_MAX];
-              g_snprintf (buf, sizeof (buf),
-                          "%s/%s", pd->path_root, param_value);
-              realpath (buf, absolute_path);
+              gchar *absolute_path;
+              buf = g_strdup_printf ("%s/%s", pd->path_root, param_value);
+              absolute_path = realpath (buf, NULL);
+              g_free (buf);
               gegl_node_set (new, param_name, absolute_path, NULL);
+              free (absolute_path);
             }
           else
             {
-              gchar absolute_path[PATH_MAX];
-              g_snprintf (buf, sizeof (buf), "./%s", param_value);
-              realpath (buf, absolute_path);
+              gchar *absolute_path;
+              buf = g_strdup_printf ("./%s", param_value);
+              absolute_path = realpath (buf, NULL);
+              g_free (buf);
               gegl_node_set (new, param_name, absolute_path, NULL);
+              free (absolute_path);
             }
         }
       else if (paramspec->value_type == G_TYPE_INT)
