blob: d76b87814136ceefb50bb1925e5385ee70eeddf2 (
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
|
void *realloc (void *, unsigned long)
__attribute__((__nothrow__, __leaf__))
__attribute__((__warn_unused_result__)) __attribute__((__alloc_size__ (2)));
long *
slurp (long *buffer, unsigned long file_size)
{
unsigned long cc;
if (!__builtin_add_overflow (file_size - file_size % sizeof (long),
2 * sizeof (long), &cc))
buffer = realloc (buffer, cc);
return buffer;
}
long *
slurp1 (long *buffer, unsigned long file_size)
{
return realloc (buffer, file_size - file_size % sizeof (long));
}
long *
slurp2 (long *buffer, unsigned long file_size)
{
return realloc (buffer, (file_size / sizeof (long)) * sizeof (long));
}
|