Re: Notes when applying IO channel patch



Owen Taylor <otaylor redhat com> writes: 
> The way I'd expect it to be used would be somthing like:
> 
>  gsize old_len = str->len;
>  g_string_set_length (string, str->allocated_len - 1);
>  count = read (string, buffer, buffer->str + old_len, buffer->len - old_len);
>  g_string_set_length (string, old_len + count); 
>

That seems OK to me.
  
>  count = read (string, buffer, buffer->str + buffer->len,
>                buffer->allocated_len - old_len - 1);
>  g_string_set_length (string, buffer->len + count); 
> 

This is what I was worried about - I'd almost want to add code to make
sure it doesn't work, I think it's a bit evil.

Havoc




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]