Re: g_strstrip(" ") segfaulting?
- From: Daniel Leidert <daniel leidert spam gmx net>
- To: Leandro Pereira <leandro hardinfo org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: g_strstrip(" ") segfaulting?
- Date: Sun, 09 May 2010 01:22:54 +0200
Am Samstag, den 08.05.2010, 19:26 -0300 schrieb Leandro Pereira:
On Sat, May 8, 2010 at 7:18 PM, Daniel Leidert
<daniel leidert spam gmx net> wrote:
Is it the desired behavior, that
g_strstrip(" ")
leads to a segmentation fault? I would expect, that an empty string ("")
or NULL is returned.
The literal " " is a constant -- the operating system might allocate
that to a read-only region. Since g_strstrip() modifies the string
in-place, it isn't surprising that the program segfaults. If the
string you'd like to work with g_strstrip() is a constant, you might
consider using g_strdup() (and g_free() when you're done with it).
Argh. You are right. Thanks!
Regards, Daniel
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]