This patch fixes several problems in glib/gstring.c that were causing it to
coredump or incorrectly set the string's length, and also adds a few checks to
make several routines more efficient.

The routines g_string_append(), g_string_prepend(), and g_string_insert()
were taking strlen()'s of their val argument without checking it for zero which
of course caused immediate coredumps. For all of these, I also added efficiency
checks to immediately return the string that was passed in if val is empty.

The routines g_string_append_c(), g_string_prepend_c(), and g_string_insert_c()
caused string->len to become incorrect if the char was zero. I corrected this.

Additionally, g_string_insert() and g_string_erase() weren't checking whether
their pos (and len in the case of g_string_erase) arguments were negative, I
added those checks for robustness' sake (It might have been easier to just
make them unsigned, but I didn't want to change the existing interface). I also
added an efficiency check to g_string_erase so the memmove is only run if
necessary.

The patch was generated against gtk+-1.0.0 as distributed on ftp://ftp.gimp.org

Enjoy
   Deon Ramsey (Draco)
-----------------------------------------------------------------------------

Deon Ramsey (general Librarygopher) may be reached as:
Work:                       Private:
dfkidok@dfki.uni-kl.de      ramsey@rhrk.uni-kl.de

WWW:
<A HREF="http://www.dfki.uni-kl.de/~ramsey/">Deon Ramsey</A>

Or via Snail-Mail:          Deon Ramsey
                            Koenigstr. 11
                            67655 Kaiserslautern
                            Germany

Program (Pro'-gram) n. A magic spell cast over a computer, causing it to
turn one's input into error messages.

There are many intelligent species in the Universe.
                                             They are all owned by cats.

Be discreet, be polite, but be yourself. -- Per Aspera

