Re: [GnomeMeeting-devel-list] [PRE-PATCH] private struct _GmTextChat



Le 26/1/2004, "PUYDT Julien" <julien puydt laposte net> a écrit:

>> Among others because you are using malloc, when I'm using new. And there
>> is a good reason why new is used (not in the text chat, but for the
>> rest).
>
>Does "new" guarantee that the memory allocation was successful? Because
>that's something the patch didn't check, but really should have...

Nope, but when you have objects like PStringArray inside a structure,
malloc won't work, you need to use new so that the object inside the
structure is created.

>With the unknow part of the structure being a pointer, this is not
>really needed anymore.
>
>But notice that doing a:
>chat = new thingie ();
>then later on:
>oh_please_init_that (chat);
>is dirty! It really should be:
>chat = get_me_a_new_one_please_thanks ();


chat = gnomemeeting_text_chat_new () should allocate the structure and
fill in its elements.

Damien



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