[OPEN-ILS-DEV] C nits: utils.h

David J. Fiander djfiander at fastmail.fm
Sat Mar 31 07:03:51 EDT 2007


OK, this piqued my curiosity.

After having complained in the past about portability, I am now going  
to make a non-portable suggestion.  Since you're using gcc, ALL of  
the macros at the beginning of utils.h should be inline functions.

I really need to not look at your C code, guys.

-  David

On 30-Mar-07, at 22:38 , Scott McKellar wrote:

> In utils.h, the OSRF_MALLOC macro should be wrapped in a do-while-zero
> loop, like the OSRF_BUFFER_ADD and OSRF_BUFFER_ADD_CHAR macros.
>
> Otherwise, suppose someone codes something like:
>
>    char * p;
>    ...
>    if( p = NULL )
>       OSRF_MALLOC( p, sizeof( foo ) );

You mean,

	if (p == NULL)

obviously.

-- 
David J. Fiander
Digital Services Librarian





More information about the Open-ils-dev mailing list