Re: [AGGREGATED PATCH] Fix in-place editing functions in convert.c

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dmitry Potapov
Date: Friday, October 5, 2007 - 12:27 pm

On 10/5/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:

I am afraid you cannot allow the direct access to the internal buffer of
a string if this buffer can be implicitly shared between different
instances as it is the case with QString. Because when you want to make
some modification or want to get a non-const pointer to this buffer, its
content has to be copied if the buffer is shared between a few copies.

On the other hand, I don't see what is the problem with using C string
routines with it. ::data() returns a pointer and :capacity () returns
allocated size of the buffer. ::resize() changes the size of the string.
If you need a greater allocated size, you can use ::reserve().
Or did I miss something?

Dmitry
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix memory leak in apply_filter., Pierre Habouzit, (Fri Oct 5, 1:27 am)
[PATCH] Fix memory leak in apply_filter., Pierre Habouzit, (Fri Oct 5, 1:29 am)
Re: [PATCH] Fix in-place editing in crlf_to_git and ident_ ..., Johannes Schindelin, (Fri Oct 5, 1:30 am)
Re: [AGGREGATED PATCH] Fix in-place editing functions in c ..., Dmitry Potapov, (Fri Oct 5, 12:27 pm)