[libgit2-glib/wip/development: 4/12] Fix ggit_config_find_system and ggit_config_find_global



commit 974a2f4b61953d371c2716ebd4f8e19ba22517c4
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Apr 26 15:32:22 2014 +0200

    Fix ggit_config_find_system and ggit_config_find_global

 libgit2-glib/ggit-config.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/libgit2-glib/ggit-config.c b/libgit2-glib/ggit-config.c
index 60a2fd0..fcf3d93 100644
--- a/libgit2-glib/ggit-config.c
+++ b/libgit2-glib/ggit-config.c
@@ -177,16 +177,16 @@ ggit_config_new_default (GError **error)
 GFile *
 ggit_config_find_global (void)
 {
-       gchar path[GIT_PATH_MAX];
+       git_buf buf;
+       GFile *path = NULL;
 
-       if (git_config_find_global (path, GIT_PATH_MAX) != GIT_OK)
+       if (git_config_find_global (&buf) == GIT_OK)
        {
-               return NULL;
-       }
-       else
-       {
-               return g_file_new_for_path (path);
+               path = g_file_new_for_path (buf.ptr);
+               git_buf_free (&buf);
        }
+
+       return path;
 }
 
 /**
@@ -206,16 +206,16 @@ ggit_config_find_global (void)
 GFile *
 ggit_config_find_system (void)
 {
-       gchar path[GIT_PATH_MAX];
+       git_buf buf;
+       GFile *path = NULL;
 
-       if (git_config_find_system (path, GIT_PATH_MAX) != GIT_OK)
+       if (git_config_find_system (&buf) == GIT_OK)
        {
-               return NULL;
-       }
-       else
-       {
-               return g_file_new_for_path (path);
+               path = g_file_new_for_path (buf.ptr);
+               git_buf_free (&buf);
        }
+
+       return path;
 }
 
 /**


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