mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-12 13:49:22 +01:00
Indentation fixes, some rewriting of docs to conform to gtk-doc standard.
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com> * glib/gdir.[ch]: Indentation fixes, some rewriting of docs to conform to gtk-doc standard. * glib/gdir.[ch] (g_dir_close): Remove the boolean return value. What would you do if closing failed? What would the user do if you printed a warning message "closing directory %d failed"?
This commit is contained in:
parent
3a86505c77
commit
ae86dd0c4b
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
Sun Nov 4 20:29:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* glib/gdir.[ch]: Indentation fixes, some rewriting of docs to
|
||||||
|
conform to gtk-doc standard.
|
||||||
|
|
||||||
|
* glib/gdir.[ch] (g_dir_close): Remove the boolean
|
||||||
|
return value. What would you do if closing failed?
|
||||||
|
What would the user do if you printed a warning
|
||||||
|
message "closing directory %d failed"?
|
||||||
|
|
||||||
2001-11-04 Hans Breuer <hans@breuer.org>
|
2001-11-04 Hans Breuer <hans@breuer.org>
|
||||||
|
|
||||||
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
* glib/gdir.[hc] : (new files) simplified wrapper around dirent
|
||||||
|
45
glib/gdir.c
45
glib/gdir.c
@ -35,17 +35,24 @@
|
|||||||
|
|
||||||
struct _GDir
|
struct _GDir
|
||||||
{
|
{
|
||||||
/*< private >*/
|
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_dir_open:
|
* g_dir_open:
|
||||||
* @path: the path to the directory you are interested in
|
* @path: the path to the directory you are interested in
|
||||||
* @flags: for future binary compatible extensions
|
* @flags: Currently must be set to 0. Reserved for future use.
|
||||||
* @error: return location for a #GError
|
* @error: return location for a #GError, or %NULL.
|
||||||
|
* If non-%NULL, an error will be set if and only if
|
||||||
|
* g_dir_open_fails.
|
||||||
*
|
*
|
||||||
* Return value: a #GDir* on success, NULL if error is set
|
* Opens a directory for reading. The names of the files
|
||||||
|
* in the directory can then be retrieved using
|
||||||
|
* g_dir_get_name().
|
||||||
|
*
|
||||||
|
* Return value: a newly allocated #GDir on success, %NULL on failure.
|
||||||
|
* If non-%NULL, you must free the result with g_dir_close()
|
||||||
|
* when you are finished with it.
|
||||||
**/
|
**/
|
||||||
GDir *
|
GDir *
|
||||||
g_dir_open (const gchar *path,
|
g_dir_open (const gchar *path,
|
||||||
@ -63,8 +70,8 @@ g_dir_open (const gchar *path,
|
|||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_FILE_ERROR,
|
G_FILE_ERROR,
|
||||||
g_file_error_from_errno (errno),
|
g_file_error_from_errno (errno),
|
||||||
_("Error opening dir '%s': %s"),
|
_("Error opening directory '%s': %s"),
|
||||||
path, strerror (errno));
|
path, strerror (errno));
|
||||||
|
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -74,17 +81,15 @@ g_dir_open (const gchar *path,
|
|||||||
* g_dir_read_name:
|
* g_dir_read_name:
|
||||||
* @dir: a #GDir* created by g_dir_open()
|
* @dir: a #GDir* created by g_dir_open()
|
||||||
*
|
*
|
||||||
* Iterator which delivers the next directory entries name
|
* Retrieves the name of the next entry in the directory.
|
||||||
* with each call. The '.' and '..' entries are omitted.
|
* The '.' and '..' entries are omitted.
|
||||||
*
|
*
|
||||||
* BTW: using these functions will simplify porting of
|
* Return value: The entries name or %NULL if there are no
|
||||||
* your app, at least to Windows.
|
* more entries. The return value is owned by GLib and
|
||||||
*
|
* must not be modified or freed.
|
||||||
* Return value: The entries name or NULL if there are no
|
|
||||||
* more entries. Don't free this value!
|
|
||||||
**/
|
**/
|
||||||
G_CONST_RETURN gchar*
|
G_CONST_RETURN gchar*
|
||||||
g_dir_read_name (GDir *dir)
|
g_dir_read_name (GDir *dir)
|
||||||
{
|
{
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
|
||||||
@ -92,8 +97,8 @@ g_dir_read_name (GDir *dir)
|
|||||||
|
|
||||||
entry = readdir (dir->dir);
|
entry = readdir (dir->dir);
|
||||||
while (entry
|
while (entry
|
||||||
&& ( 0 == strcmp (entry->d_name, ".")
|
&& (0 == strcmp (entry->d_name, ".") ||
|
||||||
|| 0 == strcmp (entry->d_name, "..")))
|
0 == strcmp (entry->d_name, "..")))
|
||||||
entry = readdir (dir->dir);
|
entry = readdir (dir->dir);
|
||||||
|
|
||||||
return entry->d_name;
|
return entry->d_name;
|
||||||
@ -119,18 +124,14 @@ g_dir_rewind (GDir *dir)
|
|||||||
* @dir: a #GDir* created by g_dir_open()
|
* @dir: a #GDir* created by g_dir_open()
|
||||||
*
|
*
|
||||||
* Closes the directory and deallocates all related resources.
|
* Closes the directory and deallocates all related resources.
|
||||||
*
|
|
||||||
* Return value: TRUE on success, FALSE otherwise.
|
|
||||||
**/
|
**/
|
||||||
gboolean
|
void
|
||||||
g_dir_close (GDir *dir)
|
g_dir_close (GDir *dir)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (dir != NULL, FALSE);
|
g_return_val_if_fail (dir != NULL, FALSE);
|
||||||
|
|
||||||
ret = closedir (dir->dir);
|
closedir (dir->dir);
|
||||||
g_free (dir);
|
g_free (dir);
|
||||||
|
|
||||||
return !ret;
|
|
||||||
}
|
}
|
||||||
|
11
glib/gdir.h
11
glib/gdir.h
@ -7,11 +7,12 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
typedef struct _GDir GDir;
|
typedef struct _GDir GDir;
|
||||||
|
|
||||||
GDir *g_dir_open (const gchar *path, guint flags, GError **error);
|
GDir * g_dir_open (const gchar *path,
|
||||||
G_CONST_RETURN
|
guint flags,
|
||||||
gchar *g_dir_read_name (GDir *dir);
|
GError **error);
|
||||||
void g_dir_rewind (GDir *dir);
|
G_CONST_RETURN gchar *g_dir_read_name (GDir *dir);
|
||||||
gboolean g_dir_close (GDir *dir);
|
void g_dir_rewind (GDir *dir);
|
||||||
|
void g_dir_close (GDir *dir);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user