Andrei Pelinescu-Onciul wrote:
> andrei      2008/05/21 23:31:19 CEST
> 
>   SER CVS Repository
> 
>   Modified files:
>     .                    ut.h 
>   Log:
>   - added ushort2sbuf() and ushort2str(): they convert an unsigned short into
>    its ascii representation (base 10). ushort2str() returns a pointer to a 
> null
>     terminated static string, while ushor2sbuf() fills the supplied buffer.
>   

Andrei,


the code that was added declares the buffer static (i.e.
not on the call stack):


         static inline char* ushort2str(unsigned short u)
         {
                 static char buf[USHORT2STR_MAX_LEN];
                 int len;
        
                 len=ushort2sbuf(u, buf, sizeof(buf)-1);
                 buf[len]=0;
                 return buf;
         }


this means that the function is not re-entrant, and will not
work in multi-thread/proc environments..

I suggest changing "static char buf" to "char buf"..


/alfred
_______________________________________________
Serdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/serdev

Reply via email to