Mailing List archive

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

[vdr] Re: plugins reentrance?



On Saturday 04 December 2004 18:12, Rainer Zocholl wrote:
> UseNet-Posting-Nospam-74308-@zocki.toppoint.de(Rainer Zocholl)  04.12.04
> 17:10
>
>
> Corrected version:
>
> To avoid such hard to find problems it may be useful
> to include such macros into vdr.h or similar important inlude
>
> #define strtok "please use strtok_r"
> ...
>
>
> That is intended to give a syntax errors when non _r functions are
> used.
> So it's impossible to use that functions witout an "undef"
> and the programmes gets an instant beat on his fingers.

It is probably much fun to find why the compiler spits on the
innocent looking strtok function call. You have to read preprocessor
output to find out that somebody fiddled in a define for it, as it
won't be obvious.

IMO a better way would be:

#define warn_func(x) \
  #warning "Using non thread safe function call" \
  printf("%s:%d: replace %s with %s_r here\n",__FILE__,__LINE__,x),x

#define strtok warn_func(strtok)
#define localtime warn_func(localtime)
...

Kind regards,
Stefan




Home | Main Index | Thread Index