#P glib
Index: glib/garray.c
===================================================================
--- glib/garray.c	(revision 7828)
+++ glib/garray.c	(working copy)
@@ -312,11 +312,16 @@
 		     user_data);
 }
 
+/* Returns the smallest power of 2 greater than n, or n if
+ * such power does not fit in a guint
+ */
+static guint
+g_nearest_pow (guint num)
+{
+  guint n = 1;
 
-static gint
-g_nearest_pow (gint num)
-{
-  gint n = 1;
+  if (num > ((guint) ~0) >> 1)
+    return num;
 
   while (n < num)
     n <<= 1;
