git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Oct 5, 2007, 19:27 UTC
Message-ID
<37fcd2780710051227n96d29a9v543831ca8292c862@mail.gmail.com>
In-Reply-To
<alpine.LFD.0.999.0710051036282.23684@woody.linux-foundation.org>
On 10/5/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 6 quoted lines
>  - Qt (QString): QString::"data()", "ascii()" or "utf8()" or something.
>
>    At least this has the excuse of really being able to handle different
>    locales (it didn't do that originally, though!), but they end up having
>    a million helper functions exactly because you cannot use the normal
>    string routines on anything!

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
Previous: Linus TorvaldsNext: Linus Torvalds
Message 13 of 18 in “Fix in-place editing in crlf_to_git and ident_to_git.”
  1. Fix in-place editing in crlf_to_git and ident_to_git.Pierre Habouzit, Oct 5, 2007
  2. Fix in-place editing functions in convert.cPierre Habouzit, Oct 5, 2007
  3. Johannes SixtOct 5, 2007
  4. Bernt HansenOct 5, 2007
  5. Linus TorvaldsOct 5, 2007
  6. Pierre HabouzitOct 5, 2007
  7. Sam RavnborgOct 5, 2007
  8. Pierre HabouzitOct 5, 2007
  9. Sam RavnborgOct 5, 2007
  10. Linus TorvaldsOct 5, 2007
  11. Sam RavnborgOct 5, 2007
  12. Linus TorvaldsOct 5, 2007
  13. Dmitry PotapovOct 5, 2007
  14. Linus TorvaldsOct 5, 2007
  15. Fix memory leak in apply_filter.Pierre Habouzit, Oct 5, 2007
  16. Fix memory leak in apply_filter.Pierre Habouzit, Oct 5, 2007
  17. Johannes SchindelinOct 5, 2007
  18. Pierre HabouzitOct 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.