librsync
2.0.2
src
util.c
1
/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2
*
3
* librsync -- the library for network deltas
4
*
5
* Copyright (C) 2000, 2001 by Martin Pool <mbp@sourcefrog.net>
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as published by
9
* the Free Software Foundation; either version 2.1 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
*/
21
22
/*=
23
| On heroin, I have all the answers.
24
*/
25
26
#include "config.h"
27
#include <stdlib.h>
28
#include <string.h>
29
30
#include "
librsync.h
"
31
#include "util.h"
32
#include "
trace.h
"
33
34
void
rs_bzero(
void
*buf,
size_t
size)
35
{
36
memset(buf, 0, size);
37
}
38
39
void
*rs_alloc_struct0(
size_t
size,
char
const
*name)
40
{
41
void
*p;
42
43
if
(!(p = malloc(size))) {
44
rs_fatal(
"couldn't allocate instance of %s"
, name);
45
}
46
rs_bzero(p, size);
47
return
p;
48
}
49
50
void
*rs_alloc(
size_t
size,
char
const
*name)
51
{
52
void
*p;
53
54
if
(!(p = malloc(size))) {
55
rs_fatal(
"couldn't allocate instance of %s"
, name);
56
}
57
58
return
p;
59
}
60
61
void
*rs_realloc(
void
*ptr,
size_t
size,
char
const
*name)
62
{
63
void
*p;
64
65
if
(!(p = realloc(ptr, size))) {
66
rs_fatal(
"couldn't reallocate instance of %s"
, name);
67
}
68
return
p;
69
}
trace.h
logging functions.
librsync.h
Public header for librsync.
Generated on Wed Jul 31 2019 00:00:00 for librsync by
1.8.15