--- Erik de Castro Lopo <erikd-flac mega-nerd.com> wrote:
> Josh,
>
> I noticed the recent addition of the above file. In
that file you
> have
> things like:
>
> static void *safe_malloc_(size_t size)
> {
> /* malloc(0) is undefined; FLAC src convention
is to always
> allocate */
> if(!size)
> size++;
> return malloc(size);
> }
>
> Did you meant to have an "inline" in there to
make it:
>
> static inline void *safe_malloc_(size_t size)
>
> By making them static functions, it means that (in C at
least, not
> sure
> about C++) every object file gets a copy of these
functions whether
> they
> are used or not. It also results in a bunch of warning
messages like:
>
> ../../include/share/alloc.h:51: warning:
'safe_calloc_' defined
> but not used
> ../../include/share/alloc.h:68: warning:
'safe_malloc_add_3op_'
> defined but not used
> ../../include/share/alloc.h:79: warning:
'safe_malloc_add_4op_'
> defined but not used
> ../../include/share/alloc.h:115: warning:
'safe_malloc_mul_3op_'
> defined but not used
> ../../include/share/alloc.h:128: warning:
'safe_malloc_mul2add_'
> defined but not used
> ../../include/share/alloc.h:138: warning:
'safe_malloc_muladd2_'
> defined but not used
> ../../include/share/alloc.h:148: warning:
'safe_realloc_add_2op_'
> defined but not used
> ../../include/share/alloc.h:156: warning:
'safe_realloc_add_3op_'
> defined but not used
> ../../include/share/alloc.h:167: warning:
'safe_realloc_add_4op_'
> defined but not used
>
> In C (certainly C99, probably also C89) functions that
that are
> defined
> "static inline" are inlined if used and
ignored (ie no warnings) if
> not used.
>
> Is this stuff still a work in progress?
yes. I would use inline except I thought it is only since
C99 (not
available in C89), so I'm planning to do the same odious
hackery
that's everywhere else.
____________________________________________________________
________________________
Pinpoint customers who are looking for what you sell.
http://searchmarket
ing.yahoo.com/
_______________________________________________
Flac-dev mailing list
Flac-dev xiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
|