Re: g_strstrip(" ") segfaulting?
- From: Leandro Pereira <leandro hardinfo org>
- To: gtk-app-devel-list gnome org
- Subject: Re: g_strstrip(" ") segfaulting?
- Date: Sat, 8 May 2010 19:26:49 -0300
Daniel,
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).
Cheers,
Leandro
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]