diff --git a/docs/reference/glib/tmpl/.gitignore b/docs/reference/glib/tmpl/.gitignore
index 513daf274..2c7fc7150 100644
--- a/docs/reference/glib/tmpl/.gitignore
+++ b/docs/reference/glib/tmpl/.gitignore
@@ -24,6 +24,7 @@ linked_lists_single.sgml
markup.sgml
memory_chunks.sgml
memory.sgml
+misc_utils.sgml
option.sgml
patterns.sgml
quarks.sgml
diff --git a/docs/reference/glib/tmpl/misc_utils.sgml b/docs/reference/glib/tmpl/misc_utils.sgml
deleted file mode 100644
index 6e9d79084..000000000
--- a/docs/reference/glib/tmpl/misc_utils.sgml
+++ /dev/null
@@ -1,458 +0,0 @@
-
-Miscellaneous Utility Functions
-
-
-a selection of portable utility functions
-
-
-
-These are portable utility functions.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@application_name:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@prgname:
-
-
-
-
-
-
-
-@variable:
-@Returns:
-
-
-
-
-
-
-
-@variable:
-@value:
-@overwrite:
-@Returns:
-
-
-
-
-
-
-
-@variable:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@G_USER_DIRECTORY_DESKTOP:
-@G_USER_DIRECTORY_DOCUMENTS:
-@G_USER_DIRECTORY_DOWNLOAD:
-@G_USER_DIRECTORY_MUSIC:
-@G_USER_DIRECTORY_PICTURES:
-@G_USER_DIRECTORY_PUBLIC_SHARE:
-@G_USER_DIRECTORY_TEMPLATES:
-@G_USER_DIRECTORY_VIDEOS:
-@G_USER_N_DIRECTORIES:
-
-
-
-
-
-
-@directory:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-@file_name:
-@Returns:
-
-
-
-
-This function is deprecated and will be removed in the next major
-release of GLib. Use g_path_get_dirname() instead.
-
-
-
-Gets the directory components of a file name.
-If the file name has no directory components "." is returned.
-The returned string should be freed when no longer needed.
-
-
-@Returns: the directory components of the file.
-
-
-
-
-
-
-
-@file_name:
-@Returns:
-
-
-
-
-
-
-
-@file_name:
-@Returns:
-
-
-
-
-
-
-
-@file_name:
-@Returns:
-
-
-
-
-
-
-
-@file_name:
-@Returns:
-
-
-
-
-
-
-
-@first_element:
-@Varargs:
-@Returns:
-
-
-
-
-
-
-
-@args:
-@Returns:
-
-
-
-
-
-
-
-@separator:
-@first_element:
-@Varargs:
-@Returns:
-
-
-
-
-
-
-
-@separator:
-@args:
-@Returns:
-
-
-
-
-
-
-
-@size:
-@Returns:
-
-
-
-
-
-
-
-@program:
-@Returns:
-
-
-
-
-Find the position of the first bit set in @mask, searching from (but not
-including) @nth_bit upwards. Bits are numbered from 0 (least significant)
-to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the
-0th bit, set @nth_bit to -1.
-
-
-@mask: a #gulong containing flags.
-@nth_bit: the index of the bit to start the search from.
-@Returns: the index of the first bit set which is higher than @nth_bit.
-
-
-
-
-Find the position of the first bit set in @mask, searching from (but not
-including) @nth_bit downwards. Bits are numbered from 0 (least significant)
-to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start searching from the
-last bit, set @nth_bit to -1 or GLIB_SIZEOF_LONG * 8.
-
-
-@mask: a #gulong containing flags.
-@nth_bit: the index of the bit to start the search from.
-@Returns: the index of the first bit set which is lower than @nth_bit.
-
-
-
-
-Gets the number of bits used to hold @number,
-e.g. if @number is 4, 3 bits are needed.
-
-
-@number: a guint.
-@Returns: the number of bits used to hold @number.
-
-
-
-
-Gets the smallest prime number from a built-in array of primes which
-is larger than @num. This is used within GLib to calculate the optimum
-size of a #GHashTable.
-
-
-The built-in array of primes ranges from 11 to 13845163 such that
-each prime is approximately 1.5-2 times the previous prime.
-
-
-@num: a #guint.
-@Returns: the smallest prime number from a built-in array of primes which is
-larger than @num.
-
-
-
-
-
-
-
-@func:
-
-
-
-
-
-
-
-@string:
-@keys:
-@nkeys:
-@Returns:
-
-
-
-
-Associates a string with a bit flag.
-Used in g_parse_debug_string().
-
-
-@key: the string
-@value: the flag
-
-
-
-Declares a type of function which takes no arguments and has no return value.
-It is used to specify the type function passed to g_atexit().
-
-
-@void:
-
-
-
-
-Declares a type of function which takes an arbitrary data pointer argument
-and has no return value. It is not currently used in GLib or GTK+.
-
-
-@data: a data pointer.
-
-
-
-
-
-
-
-@pbase:
-@total_elems:
-@size:
-@compare_func:
-@user_data:
-
-
-
-
-
-
-
-@nullify_location:
-
-
diff --git a/glib/gprimes.c b/glib/gprimes.c
index 6698c5606..6e273431b 100644
--- a/glib/gprimes.c
+++ b/glib/gprimes.c
@@ -71,16 +71,28 @@ static const guint g_primes[] =
13845163,
};
-static const guint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
-
+/**
+ * g_spaced_primes_closest:
+ * @num: a #guint
+ *
+ * Gets the smallest prime number from a built-in array of primes which
+ * is larger than @num. This is used within GLib to calculate the optimum
+ * size of a #GHashTable.
+ *
+ * The built-in array of primes ranges from 11 to 13845163 such that
+ * each prime is approximately 1.5-2 times the previous prime.
+ *
+ * Returns: the smallest prime number from a built-in array of primes
+ * which is larger than @num
+ */
guint
g_spaced_primes_closest (guint num)
{
gint i;
- for (i = 0; i < g_nprimes; i++)
+ for (i = 0; i < G_N_ELEMENTS (g_primes); i++)
if (g_primes[i] > num)
return g_primes[i];
- return g_primes[g_nprimes - 1];
+ return g_primes[G_N_ELEMENTS (g_primes) - 1];
}
diff --git a/glib/gtypes.h b/glib/gtypes.h
index 966f73141..8e77563da 100644
--- a/glib/gtypes.h
+++ b/glib/gtypes.h
@@ -92,6 +92,15 @@ typedef guint (*GHashFunc) (gconstpointer key);
typedef void (*GHFunc) (gpointer key,
gpointer value,
gpointer user_data);
+
+/**
+ * GFreeFunc:
+ * @data: a data pointer
+ *
+ * Declares a type of function which takes an arbitrary
+ * data pointer argument and has no return value. It is
+ * not currently used in GLib or GTK+.
+ */
typedef void (*GFreeFunc) (gpointer data);
/**
diff --git a/glib/gutils.c b/glib/gutils.c
index 604d8c201..cb089264a 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -77,6 +77,15 @@
#include "gwin32.h"
#endif
+
+/**
+ * SECTION:misc_utils
+ * @title: Miscellaneous Utility Functions
+ * @short_description: a selection of portable utility functions
+ *
+ * These are portable utility functions.
+ */
+
#ifdef MAXPATHLEN
#define G_PATH_LENGTH MAXPATHLEN
#elif defined (PATH_MAX)
@@ -914,6 +923,56 @@ g_path_skip_root (const gchar *file_name)
return NULL;
}
+/**
+ * g_bit_nth_lsf:
+ * @mask: a #gulong containing flags
+ * @nth_bit: the index of the bit to start the search from
+ *
+ * Find the position of the first bit set in @mask, searching
+ * from (but not including) @nth_bit upwards. Bits are numbered
+ * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
+ * usually). To start searching from the 0th bit, set @nth_bit to -1.
+ *
+ * Returns: the index of the first bit set which is higher than @nth_bit
+ */
+
+/**
+ * g_bit_nth_msf:
+ * @mask: a #gulong containing flags
+ * @nth_bit: the index of the bit to start the search from
+ *
+ * Find the position of the first bit set in @mask, searching
+ * from (but not including) @nth_bit downwards. Bits are numbered
+ * from 0 (least significant) to sizeof(#gulong) * 8 - 1 (31 or 63,
+ * usually). To start searching from the last bit, set @nth_bit to
+ * -1 or GLIB_SIZEOF_LONG * 8.
+ *
+ * Returns: the index of the first bit set which is lower than @nth_bit
+ */
+
+/**
+ * g_bit_storage:
+ * @number: a #guint
+ *
+ * Gets the number of bits used to hold @number,
+ * e.g. if @number is 4, 3 bits are needed.
+ *
+ * Returns: the number of bits used to hold @number
+ */
+
+/**
+ * g_dirname:
+ * @file_name: the name of the file
+ *
+ * Gets the directory components of a file name.
+ * If the file name has no directory components "." is returned.
+ * The returned string should be freed when no longer needed.
+ *
+ * Returns: the directory components of the file
+ *
+ * Deprecated: use g_path_get_dirname() instead
+ */
+
/**
* g_path_get_dirname:
* @file_name: the name of the file.
diff --git a/glib/gutils.h b/glib/gutils.h
index cfb745f67..edf9c3c2a 100644
--- a/glib/gutils.h
+++ b/glib/gutils.h
@@ -196,7 +196,15 @@ typedef enum {
G_CONST_RETURN gchar* g_get_user_special_dir (GUserDirectory directory);
-typedef struct _GDebugKey GDebugKey;
+/**
+ * GDebugKey:
+ * @key: the string
+ * @value: the flag
+ *
+ * Associates a string with a bit flag.
+ * Used in g_parse_debug_string().
+ */
+typedef struct _GDebugKey GDebugKey;
struct _GDebugKey
{
const gchar *key;
@@ -226,10 +234,6 @@ G_CONST_RETURN gchar* g_path_skip_root (const gchar *file_name);
#ifndef G_DISABLE_DEPRECATED
-/* These two functions are deprecated and will be removed in the next
- * major release of GLib. Use g_path_get_dirname/g_path_get_basename
- * instead. Whatch out! The string returned by g_path_get_basename
- * must be g_freed, while the string returned by g_basename must not.*/
G_CONST_RETURN gchar* g_basename (const gchar *file_name);
#define g_dirname g_path_get_dirname
@@ -272,13 +276,16 @@ gchar** g_get_environ (void);
const gchar* _g_getenv_nomalloc (const gchar *variable,
gchar buffer[1024]);
-/* we try to provide a useful equivalent for ATEXIT if it is
- * not defined, but use is actually abandoned. people should
- * use g_atexit() instead.
+/**
+ * GVoidFunc:
+ *
+ * Declares a type of function which takes no arguments
+ * and has no return value. It is used to specify the type
+ * function passed to g_atexit().
*/
-typedef void (*GVoidFunc) (void);
+typedef void (*GVoidFunc) (void);
#ifndef ATEXIT
-# define ATEXIT(proc) g_ATEXIT(proc)
+# define ATEXIT(proc) g_ATEXIT(proc)
#else
# define G_NATIVE_ATEXIT
#endif /* ATEXIT */