Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/eglib
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2009-02-26 07:00:13 +0300
committerMiguel de Icaza <miguel@gnome.org>2009-02-26 07:00:13 +0300
commit456f323eb9a1ae89db50594134c78cd06114ef10 (patch)
tree621a2b50f2b4dcd3eb37743aea135b1f1736669e /eglib
parenta71b039661c82d95a61911eeeb6a23d4cfeedab3 (diff)
Add support for platforms without rewinddir
svn path=/trunk/mono/; revision=128052
Diffstat (limited to 'eglib')
-rw-r--r--eglib/configure.ac2
-rw-r--r--eglib/src/gdir-unix.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/eglib/configure.ac b/eglib/configure.ac
index ab1a93ab6a7..611bce59d24 100644
--- a/eglib/configure.ac
+++ b/eglib/configure.ac
@@ -55,7 +55,7 @@ AM_CONDITIONAL(PLATFORM_WIN32, test x$OS = xWIN32)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
-AC_CHECK_FUNCS(strndup strlcpy getpwent_r strtok_r)
+AC_CHECK_FUNCS(strndup strlcpy getpwent_r strtok_r rewinddir)
AC_CHECK_LIB(iconv, libiconv_open, LIBS="$LIBS -liconv")
old_ldflags="${LDFLAGS}"
LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
diff --git a/eglib/src/gdir-unix.c b/eglib/src/gdir-unix.c
index aa375d81270..6fe64c8d433 100644
--- a/eglib/src/gdir-unix.c
+++ b/eglib/src/gdir-unix.c
@@ -36,6 +36,9 @@
struct _GDir {
DIR *dir;
+#ifndef HAVE_REWINDDIR
+ char *path;
+#endif
};
GDir *
@@ -57,6 +60,9 @@ g_dir_open (const gchar *path, guint flags, GError **error)
g_free (dir);
return NULL;
}
+#ifndef HAVE_REWINDDIR
+ dir->path = g_strdup (path);
+#endif
return dir;
}
@@ -79,7 +85,12 @@ void
g_dir_rewind (GDir *dir)
{
g_return_if_fail (dir != NULL && dir->dir != NULL);
+#ifndef HAVE_REWINDDIR
+ closedir (dir->dir);
+ dir->dir = opendir (dir->path);
+#else
rewinddir (dir->dir);
+#endif
}
void
@@ -87,6 +98,9 @@ g_dir_close (GDir *dir)
{
g_return_if_fail (dir != NULL && dir->dir != 0);
closedir (dir->dir);
+#ifndef HAVE_REWINDDIR
+ g_free (dir->path);
+#endif
dir->dir = NULL;
g_free (dir);
}