Verified Commit e3d2ec03 authored by A. Wilcox's avatar A. Wilcox

string: reduce scope of variables in strfry

parent c820eed5
......@@ -288,17 +288,16 @@ void *memfrob(void *s, size_t n)
char *strfry(char *s)
{
static unsigned int seed;
size_t len = strlen(s), i, j;
char t;
size_t len = strlen(s);
if (!len)
return s;
seed += time(NULL) ^ getpid() ^ (uintptr_t) s;
for (i = 0; i < len - 1; ++i) {
j = rand_r(&seed) % (len - i) + i;
t = s[i];
for (size_t i = 0; i < len - 1; ++i) {
size_t j = rand_r(&seed) % (len - i) + i;
char t = s[i];
s[i] = s[j];
s[j] = t;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment