gwmem patches

Alexander Malysh amalysh at kannel.org
Fri Apr 3 14:08:10 CEST 2009


Hi,

2009/4/3 Nikos Balkanas <nbalkanas at gmail.com>

>  Hi,
>
> Thanx for your fast response. Must be going crazy reviewing all these
> patches :-).
>
> 1) Thread.h: Hmmm I thought I got the function prototype correctly. Well it
> worked for me. I will have to check with the cvs.
> 2) OK.
> 3) Because calloc is undeffed in gwmem.h. If we try to use it it prints
> "do_not_call_calloc_directly". Yet no gw_calloc exists! What's a poor
> programmer to do? :-(. Well you could use malloc + memset (x, 0, n), but
> then so you could in ANSI C, yet calloc exists I suspect it si more
> performance related rather than simplicity. It is a normal C function, and I
> don't the reason to undef it without giving its counterpart.
>

it's not a question whether it exists in gwlib or not. it's just a question,
why you use it? I know such function but never used it before and never
missed it because malloc + memset does the same for me and it clear for
reader what's going on. And from
kernel perspective it's the same malloc + memset...
Give me at least one argument why we _really_ need calloc?

My vote is 0.
How about other developers? do we need calloc?


> Let me know if it is OK with calloc, so that I can submit it together with
> strdup.
>
> BR,
> Nikos
>
> ----- Original Message -----
> *From:* Alexander Malysh <amalysh at kannel.org>
> *To:* Nikos Balkanas <nbalkanas at gmail.com>
> *Cc:* devel at kannel.org
> *Sent:* Friday, April 03, 2009 12:21 AM
> *Subject:* Re: gwmem patches
>
> Hi,
> thanks for your patch but:
>
> 1) thread.h patch was wrong. I fixed it in CVS.
> 2) gw_strdup optimisation looks OK, please submit as extra patch
> 3) gw_calloc, hmm... I don't really see any advantage of this one. because
> x = gw_malloc(count*size);
> memset(x, 0);
>     do the same. why do we need this?
>
> Thanks,
> Alex
>
>  Am 02.04.2009 um 19:09 schrieb Nikos Balkanas:
>
>  Hi,
>
> An assortment of small patches to make check_memory_leaks work better:
>
> 1) Added support for gw_calloc, which is #undefed but not defined
> 2) Replaced strcpy with memcpy in gw_strdup for better efficiency
> 3) Added function prototype in thread.h for mutex_make_measured so that
> MUTEX_STATS compile correctly.
>
> Please decide and vote.
>
> BR,
> Nikos<kannel.diff>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.kannel.org/pipermail/devel/attachments/20090403/75efe5d9/attachment.html>


More information about the devel mailing list