Re: GLIB Hash Data


Is it common practice to use GStrings in this circumstance?


On 2002.04.25 07:33 Sven Neumann wrote:
> Hi,
> 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
> strings?
> Salut, Sven

Brooklyn Linux Solutions
__________________________ - Consulting - For the love of Brooklyn - Leadership Development in Free Software - The foundation of Democracy - Unpublished Archive or stories and articles from around the net - Imagine my surprise when I saw you... - See the New Downtown Brooklyn....


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