$treeview $search $mathjax $extrastylesheet
librsync
2.0.2
$projectbrief
|
$projectbrief
|
$searchbox |
00001 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- 00002 * 00003 * librsync -- the library for network deltas 00004 * 00005 * Copyright (C) 2000, 2001 by Martin Pool <mbp@sourcefrog.net> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU Lesser General Public License as published by 00009 * the Free Software Foundation; either version 2.1 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 */ 00021 00022 /*= 00023 | On heroin, I have all the answers. 00024 */ 00025 00026 #include "config.h" 00027 #include <stdlib.h> 00028 #include <string.h> 00029 00030 #include "librsync.h" 00031 #include "util.h" 00032 #include "trace.h" 00033 00034 void rs_bzero(void *buf, size_t size) 00035 { 00036 memset(buf, 0, size); 00037 } 00038 00039 void *rs_alloc_struct0(size_t size, char const *name) 00040 { 00041 void *p; 00042 00043 if (!(p = malloc(size))) { 00044 rs_fatal("couldn't allocate instance of %s", name); 00045 } 00046 rs_bzero(p, size); 00047 return p; 00048 } 00049 00050 void *rs_alloc(size_t size, char const *name) 00051 { 00052 void *p; 00053 00054 if (!(p = malloc(size))) { 00055 rs_fatal("couldn't allocate instance of %s", name); 00056 } 00057 00058 return p; 00059 } 00060 00061 void *rs_realloc(void *ptr, size_t size, char const *name) 00062 { 00063 void *p; 00064 00065 if (!(p = realloc(ptr, size))) { 00066 rs_fatal("couldn't reallocate instance of %s", name); 00067 } 00068 return p; 00069 }