ObjFW  Diff

Differences From Artifact [9420a38fbf]:

To Artifact [3f9a87cf9e]:


844
845
846
847
848
849
850




















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
}