summaryrefslogtreecommitdiff
path: root/stdio.c
blob: 0d41f86d0f937fe4488dd48431b74045a76cc470 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

size_t b_stdio_putcgetc(void *dummy)
{
	FILE *f = tmpfile();
	size_t i;
	size_t cs;

	for (i=0; i<5000000; i++)
		putc('x', f);
	fseeko(f, 0, SEEK_SET);
	for (i=0; i<5000000; i++)
		cs += getc(f);
	fclose(f);

	return cs;
}

size_t b_stdio_putcgetc_unlocked(void *dummy)
{
	FILE *f = tmpfile();
	size_t i;
	size_t cs;

	for (i=0; i<5000000; i++)
		putc_unlocked('x', f);
	fseeko(f, 0, SEEK_SET);
	for (i=0; i<5000000; i++)
		cs += getc_unlocked(f);
	fclose(f);

	return cs;
}