Re: GLIB Hash Data
- From: Ruben I Safir <ruben mrbrklyn com>
- To: Mark Mielke <mark mark mielke cc>
- Cc: Ruben I Safir <ruben mrbrklyn com>, Sven Neumann <sven gimp org>, Gtk-List <gtk-list gnome org>
- Subject: Re: GLIB Hash Data
- Date: Thu, 25 Apr 2002 12:26:10 -0400
Hello
strdup is not in my copy of ANSI c, which is in the KN King book,
C Programming, A Modern Approach. I originally learned
C from this text about 6 years ago. So I'm not familiar with strdup.
I would just have documented that it creates a newly allocated string which
safely allocates memory to a new memory location in the returned char pointer.
Why did you paste the documentation which is already on line?
I have one more squestion. When compiling I get this warning:
warning: passing arg 1 of `g_hash_table_new' from incompatible pointer type
from this line: hTable = g_hash_table_new(HashFunction, HashCompare);
Should I cast the function pointers to some type?
Ruben
On 2002.04.25 12:10 Mark Mielke wrote:
> On Thu, Apr 25, 2002 at 11:33:15AM -0400, Ruben I Safir wrote:
> > In regards to g_strdup, do I need to allocate the memory for the
> > returned string. It's not clear in the documentation. Or do I
> > still need to allocate the memory seperately
>
> >From the API reference:
>
> g_strdup ()
> gchar* g_strdup (const gchar *str);
>
> Duplicates a string. The returned string should be freed when no
> longer needed.
>
> str : the string to duplicate.
> Returns : a newly-allocated copy of str.
>
> "A newly-allocated copy of str."
>
> I suppose it could have an entire paragraph that details how it happens
> to use g_new() and strcpy() underneath... but really...
>
> Anybody who has ever used C before for any length of time, knows what
> strdup() is. One would assume that g_strdup() worked very similar to
> strdup()...
>
> I suggest you read the documentation over once before beginning.
>
> mark
>
> --
> mark mielke cc/markm ncf ca/markm nortelnetworks com __________________________
> . . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
> |\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
> | | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada
>
> One ring to rule them all, one ring to find them, one ring to bring them all
> and in the darkness bind them...
>
> http://mark.mielke.cc/
>
--
__________________________
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....
1-718-382-5752
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]