Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 The University of Utah
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __UTIL_H__
20 #define __UTIL_H__
21 
22 #include <stdsoap2.h>
23 #include <stdlib.h>
24 
25 #define SOAP_CALLOC(soap,nmemb,size) \
26  memset(soap_malloc((soap),(nmemb)*(size)),0,(nmemb)*(size));
27 
28 #define SOAP_STRCPY(soap,d,s) \
29  do { \
30  char *_ss = (s); \
31  int _rc; \
32  \
33  if (!_ss) \
34  (d) = NULL; \
35  else { \
36  _rc = strlen(_ss) + 1; \
37  (d) = soap_malloc((soap),_rc); \
38  strncpy((d),_ss,_rc); \
39  } \
40  } while (0);
41 
42 #endif /* __UTIL_H__ */