[Developers] cctk_WarnLevel.h and WarnLevel.c: register the callbacks and call them

Jian Tao jtao at cct.lsu.edu
Wed Jun 22 17:10:26 CDT 2005


Hi,

Here comes the updated patches solving the problems that Tom mentioned. 

On Tuesday 21 June 2005 02:34 am, you wrote:
> the patch looks generally ok, I'd like a few things changed before I apply
> it, 'though:
>
>    - Make the internal functions static, as they don't need to be in the
>      external namespace.  Thus they will not appear in the header.
They are now "static void".

>    - Add a check if the appropriate callback list is NULL before generating
>      the string to be passed to the callback calling routine; this will
>      save time if there are no registered callbacks.
Checks added.

>    - Use Util_asprintf, rather than vsnprintf, as the latter is not
>      standard, and the former will prevent you needing to do an explicit
>      malloc.  Don't forget to free the memory afterwards !
Util_vnsprintf instead of Util_asprintf was used to deal with variable list.
Message memory is freed after the callback functions are called.

>    - Move the routines to the "external" and "internal" sections of the .c
>      file rather than generating a new section.
Done.

>    - Make the code conform to the coding guidelines - some of the
>      indentation is a bit odd. (Or did you accidently use tabs ?)
I will blame Eclipse for that but it could be my fault. I cleaned it up with 
vi. 

>    - Don't use macros to define all the arguments.  You could provide a
>      couple of typedefs for the types of the callback functions instead as
>      a way to avoid repetition;  there shouldn't be any need for #defines
>      for the arguments for the internal functions.
Two function types were declared.

typedef void (*warnfunc)(int level,
                         int line,
                         const char *file,
                         const char *thorn,
                         const char *message,
                         void *data);

typedef void (*infofunc)(const char *thorn,
                         const char *message,
                            void *data);

My testing thorn is happy with them. 

>    - Have comments as you would like them in the final version.

Done.

> Cheers,

Cheers,
Jian


--- StripMime Report -- processed MIME parts ---
multipart/mixed
  text/plain (text body -- kept)
  text/x-diff
  text/x-diff
---



More information about the Developers mailing list