Re: GLIB Hash Data
- From: Ruben I Safir <ruben mrbrklyn com>
- To: Sven Neumann <sven gimp org>
- Cc: Ruben I Safir <ruben mrbrklyn com>, Mark Mielke <mark mark mielke cc>, Gtk-List <gtk-list gnome org>
- Subject: Re: GLIB Hash Data
- Date: Thu, 25 Apr 2002 11:28:46 -0400
Is it common practice to use GStrings in this circumstance?
On 2002.04.25 07:33 Sven Neumann wrote:
> Ruben I Safir <ruben mrbrklyn com> writes:
> > The example is very simple. Take in data from STDIN and use it for hash
> > keys and values. I have to create a new pointer every time to do this
> > with the hash functions in glib. The only way I can think of doing this is
> > with mallac. The STDIN has to go into a defined buffer which will point
> > to the same emmory location every time. Even strcpy would be useless
> > in this case without mallocing new memory by hand every time.
> that's why there's g_strdup() which does just that.
> > IF it sees it's a char * it should just take in the data.
> there is no way for glib to check if the pointer passed in is pointing
> to a character array. Even if there would be a way, how is it supposed
> to know if it needs to copy the string or if you are using static
> Salut, Sven
Brooklyn Linux Solutions
http://www.mrbrklyn.com - Consulting
http://www.brooklynonline.com - For the love of Brooklyn
http://www.nylxs.com - Leadership Development in Free Software
http://www.nyfairuse.org - The foundation of Democracy
http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net
http://www2.mrbrklyn.com/mp3/dr.mp3 - Imagine my surprise when I saw you...
http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn....
] [Thread Prev