Compile fix
examples/perf.c: In function ‘perf_rand’:
examples/perf.c:42:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (size_t sz = 2; sz <= alloc_sz; sz <<= 1) {
This commit is contained in:
@@ -32,6 +32,7 @@ static void perf_rand(xmpp_ctx_t *ctx)
|
|||||||
uint64_t t1, t2;
|
uint64_t t1, t2;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
const size_t alloc_sz = 0x1000u;
|
const size_t alloc_sz = 0x1000u;
|
||||||
|
size_t sz;
|
||||||
unsigned char *buf = malloc(alloc_sz);
|
unsigned char *buf = malloc(alloc_sz);
|
||||||
|
|
||||||
/* pre-heat */
|
/* pre-heat */
|
||||||
@@ -39,7 +40,7 @@ static void perf_rand(xmpp_ctx_t *ctx)
|
|||||||
xmpp_rand_bytes(rng, buf, n * 10);
|
xmpp_rand_bytes(rng, buf, n * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t sz = 2; sz <= alloc_sz; sz <<= 1) {
|
for (sz = 2; sz <= alloc_sz; sz <<= 1) {
|
||||||
t2 = 0;
|
t2 = 0;
|
||||||
for (n = 0; n < 1000u; ++n) {
|
for (n = 0; n < 1000u; ++n) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user