<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Sorry all, I've been having mail client issues, I hope this goes to
    the list this time.<br>
    <br>
    Cheers,<br>
    Matthew Brush (codebrainz)<br>
    <br>
    -------- Original Message --------
    <table class="moz-email-headers-table" border="0" cellpadding="0"
      cellspacing="0">
      <tbody>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject: </th>
          <td>Re: [Geany-devel] Changes to templates</td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
          <td>Sun, 13 Mar 2011 11:53:46 -0700</td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
          <td>Matthew Brush <a class="moz-txt-link-rfc2396E" href="mailto:matthewbrush@gmail.com"><matthewbrush@gmail.com></a></td>
        </tr>
        <tr>
          <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
          <td>Lex Trotman <a class="moz-txt-link-rfc2396E" href="mailto:elextr@gmail.com"><elextr@gmail.com></a></td>
        </tr>
      </tbody>
    </table>
    <br>
    <br>
    <pre>On 03/13/11 03:19, Lex Trotman wrote:
>
> I don't think this is a good idea since g_strstrip() doesn't actually
> change the size recorded in the GString, it might appear to work
> sometimes but it might also fail. Note that a GString also does not
> have to be null terminated so the g_strstrip might write beyond the
> buffer if you are unlucky.  I think you are better not to do this.
>

I have updated the patch (see attachment) to be more safe, based on your 
comments.  I'm not 100% confident this is the Best Way, but maybe if 
someone has time to review the way it's being done, they could fix it or 
suggest the best way.  My idea is to allocate a buffer filled with 
zeroes, one bigger than the ->len size, copy the ->str member into the 
new buffer, except its nul char, and the new buffer is sure to have at 
least a nul at the end.  After, the new buffer is stripped of whitespace 
and split into lines.  From reading the GString docs, it sounds like the 
->str member *is* always nul terminated, but this way is safe even if it 
isn't, I think.

Is this better?  Overkill?  Stupid?

Cheers,
Matthew Brush (codebrainz)

</pre>
  </body>
</html>