INTeger-TO-Buffer-STRing : converts a 64-bit integer to a string * IMPORTANT: the provided buffer must be at least INT2STR_MAX_LEN size !! */
| 250 | /* INTeger-TO-Buffer-STRing : converts a 64-bit integer to a string |
| 251 | * IMPORTANT: the provided buffer must be at least INT2STR_MAX_LEN size !! */ |
| 252 | static inline char* int2bstr(uint64_t l, char *s, int* len) |
| 253 | { |
| 254 | int i; |
| 255 | |
| 256 | i=INT2STR_MAX_LEN-2; |
| 257 | s[INT2STR_MAX_LEN-1]=0; /* null terminate */ |
| 258 | do{ |
| 259 | s[i]=l%10+'0'; |
| 260 | i--; |
| 261 | l/=10; |
| 262 | }while(l && (i>=0)); |
| 263 | if (l && (i<0)){ |
| 264 | LM_CRIT("overflow error\n"); |
| 265 | } |
| 266 | if (len) *len=(INT2STR_MAX_LEN-2)-i; |
| 267 | return &s[i+1]; |
| 268 | } |
| 269 | |
| 270 | |
| 271 | /* INTeger-TO-STRing : convers a 64-bit integer to a string |
no outgoing calls
no test coverage detected