Move this function before g_string_append_c so that we avoid the plt call
authorAlexander Larsson <alexl@redhat.com>
Wed, 28 Nov 2007 14:49:22 +0000 (14:49 +0000)
committerAlexander Larsson <alexl@src.gnome.org>
Wed, 28 Nov 2007 14:49:22 +0000 (14:49 +0000)
2007-11-28  Alexander Larsson  <alexl@redhat.com>

* glib/gstring.c (g_string_append_uri_escaped):
Move this function before g_string_append_c so that
we avoid the plt call due to the undefinf of g_string_append_c

svn path=/trunk/; revision=5975

ChangeLog
glib/gstring.c

index b55ec02..84ff713 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-28  Alexander Larsson  <alexl@redhat.com>
+
+       * glib/gstring.c (g_string_append_uri_escaped):
+       Move this function before g_string_append_c so that
+       we avoid the plt call due to the undefinf of g_string_append_c
+
 2007-11-28  Emmanuele Bassi  <ebassi@gnome.org>
 
        * gio/Makefile.am: Remove makegioalias.pl from the marshal files
index 712dc1c..4b7c105 100644 (file)
@@ -713,6 +713,88 @@ g_string_insert_len (GString     *string,
   return string;
 }
 
+#define SUB_DELIM_CHARS  "!$&'()*+,;="
+
+static gboolean
+is_valid (char c, const char *reserved_chars_allowed)
+{
+  if (g_ascii_isalnum (c) ||
+      c == '-' ||
+      c == '.' ||
+      c == '_' ||
+      c == '~')
+    return TRUE;
+
+  if (reserved_chars_allowed &&
+      strchr (reserved_chars_allowed, c) != NULL)
+    return TRUE;
+  
+  return FALSE;
+}
+
+static gboolean 
+gunichar_ok (gunichar c)
+{
+  return
+    (c != (gunichar) -2) &&
+    (c != (gunichar) -1);
+}
+
+/**
+ * g_string_append_uri_escaped:
+ * @string: a #GString
+ * @unescaped: a string
+ * @reserved_chars_allowed: a string of reserved characters allowed to be used
+ * @allow_utf8: set %TRUE if the escaped string may include UTF8 characters
+ * 
+ * Appends @unescaped to @string, escaped any characters that
+ * are reserved in URIs using URI-style escape sequences.
+ * 
+ * Returns: @string
+ *
+ * Since: 2.16
+ **/
+GString *
+g_string_append_uri_escaped (GString *string,
+                            const char *unescaped,
+                            const char *reserved_chars_allowed,
+                            gboolean allow_utf8)
+{
+  unsigned char c;
+  const char *end;
+  static const gchar hex[16] = "0123456789ABCDEF";
+
+  g_return_val_if_fail (string != NULL, NULL);
+  g_return_val_if_fail (unescaped != NULL, NULL);
+
+  end = unescaped + strlen (unescaped);
+  
+  while ((c = *unescaped) != 0)
+    {
+      if (c >= 0x80 && allow_utf8 &&
+         gunichar_ok (g_utf8_get_char_validated (unescaped, end - unescaped)))
+       {
+         int len = g_utf8_skip [c];
+         g_string_append_len (string, unescaped, len);
+         unescaped += len;
+       }
+      else if (is_valid (c, reserved_chars_allowed))
+       {
+         g_string_append_c (string, c);
+         unescaped++;
+       }
+      else
+       {
+         g_string_append_c (string, '%');
+         g_string_append_c (string, hex[((guchar)c) >> 4]);
+         g_string_append_c (string, hex[((guchar)c) & 0xf]);
+         unescaped++;
+       }
+    }
+
+  return string;
+}
+
 /**
  * g_string_append:
  * @string: a #GString
@@ -1398,88 +1480,5 @@ g_string_append_printf (GString     *string,
   va_end (args);
 }
 
-#define SUB_DELIM_CHARS  "!$&'()*+,;="
-
-static gboolean
-is_valid (char c, const char *reserved_chars_allowed)
-{
-  if (g_ascii_isalnum (c) ||
-      c == '-' ||
-      c == '.' ||
-      c == '_' ||
-      c == '~')
-    return TRUE;
-
-  if (reserved_chars_allowed &&
-      strchr (reserved_chars_allowed, c) != NULL)
-    return TRUE;
-  
-  return FALSE;
-}
-
-static gboolean 
-gunichar_ok (gunichar c)
-{
-  return
-    (c != (gunichar) -2) &&
-    (c != (gunichar) -1);
-}
-
-/**
- * g_string_append_uri_escaped:
- * @string: a #GString
- * @unescaped: a string
- * @reserved_chars_allowed: a string of reserved characters allowed to be used
- * @allow_utf8: set %TRUE if the escaped string may include UTF8 characters
- * 
- * Appends @unescaped to @string, escaped any characters that
- * are reserved in URIs using URI-style escape sequences.
- * 
- * Returns: @string
- *
- * Since: 2.16
- **/
-GString *
-g_string_append_uri_escaped (GString *string,
-                            const char *unescaped,
-                            const char *reserved_chars_allowed,
-                            gboolean allow_utf8)
-{
-  unsigned char c;
-  const char *end;
-  static const gchar hex[16] = "0123456789ABCDEF";
-
-  g_return_val_if_fail (string != NULL, NULL);
-  g_return_val_if_fail (unescaped != NULL, NULL);
-
-  end = unescaped + strlen (unescaped);
-  
-  while ((c = *unescaped) != 0)
-    {
-      if (c >= 0x80 && allow_utf8 &&
-         gunichar_ok (g_utf8_get_char_validated (unescaped, end - unescaped)))
-       {
-         int len = g_utf8_skip [c];
-         g_string_append_len (string, unescaped, len);
-         unescaped += len;
-       }
-      else if (is_valid (c, reserved_chars_allowed))
-       {
-         g_string_append_c (string, c);
-         unescaped++;
-       }
-      else
-       {
-         g_string_append_c (string, '%');
-         g_string_append_c (string, hex[((guchar)c) >> 4]);
-         g_string_append_c (string, hex[((guchar)c) & 0xf]);
-         unescaped++;
-       }
-    }
-
-  return string;
-}
-
-
 #define __G_STRING_C__
 #include "galiasdef.c"