Differences From Artifact [9420a38fbf]:
- File
src/macros.h
— part of check-in
[156b850131]
at
2018-03-11 12:55:20
on branch trunk
— Remove OF_PATH_* macros
These were way too simplistic, as paths differ in more than just that on
various operating systems. (user: js, size: 20135) [annotate] [blame] [check-ins using]
To Artifact [3f9a87cf9e]:
- File
src/macros.h
— part of check-in
[a2a06d372a]
at
2018-07-28 16:48:55
on branch trunk
— macros.h: Add of_random()
This does *NOT* provide cryptographically secure randomness! (user: js, size: 20670) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
844 845 846 847 848 849 850 | } static OF_INLINE char of_ascii_tolower(char c) { return (c >= 'A' && c <= 'Z' ? 'a' + (c - 'A') : c); } | > > > > > > > > > > > > > > > > > > > > | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | } static OF_INLINE char of_ascii_tolower(char c) { return (c >= 'A' && c <= 'Z' ? 'a' + (c - 'A') : c); } /* This does *NOT* provide cryptographically secure randomness! */ static OF_INLINE uint32_t of_random(void) { #if defined(OF_HAVE_ARC4RANDOM) return arc4random(); #elif defined(OF_HAVE_RANDOM) struct timeval tv; gettimeofday(&tv, NULL); srandom((unsigned)(tv.tv_sec ^ tv.tv_usec)); return (((uint32_t)(random()) << 16) | ((uint32_t)(random()) & 0xFFFF); #else struct timeval tv; gettimeofday(&tv, NULL); srand((unsigned)(t.tv_sec ^ t.tv_usec)); return (((uint32_t)(rand()) << 16) | ((uint32_t)(rand()) & 0xFFFF); #endif } |