Re: g_strstrip question.



I dont think thats right:

   bbbbbbSTRINGZbbbbbZ
         ^     |
         |     +--- end of the string is now here.
         |
         +- Pointer returned is now here.

would be:

   STRINGZbbbbbbbbbbbZ
         ^     |
         |     +--- end of the string is now here.
         |
         +- Pointer returned is now here.

This is what g_strchug does when remove leading whitespace.

 When I do a g_free, would I have a bit of memory leak ? (Since it would free
only the bytes STRING ?

not true. if you did freed the n'th element of a string the memory
manager would either do nothing or perform random errors;
no one ever allocated `size' memory at n'th location of
a string.

so essentialy if strstrip did that,
not only mem leaks would occur.


Cheers,
                -Tristan



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