Char/HChar and constness fixes. Mostly cost center
[ambi/valgrind.git] / coregrind / m_debuginfo / priv_misc.h
1
2 /*--------------------------------------------------------------------*/
3 /*--- Misc simple stuff lacking a better home.        priv_misc.h ---*/
4 /*--------------------------------------------------------------------*/
5
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9
10    Copyright (C) 2008-2012 OpenWorks LLP
11       info@open-works.co.uk
12
13    This program is free software; you can redistribute it and/or
14    modify it under the terms of the GNU General Public License as
15    published by the Free Software Foundation; either version 2 of the
16    License, or (at your option) any later version.
17
18    This program is distributed in the hope that it will be useful, but
19    WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26    02111-1307, USA.
27
28    The GNU General Public License is contained in the file COPYING.
29
30    Neither the names of the U.S. Department of Energy nor the
31    University of California nor the names of its contributors may be
32    used to endorse or promote products derived from this software
33    without prior written permission.
34 */
35
36 #ifndef __PRIV_MISC_H
37 #define __PRIV_MISC_H
38
39
40 /* Allocate(zeroed), free, strdup, memdup, all in VG_AR_DINFO. */
41 void*  ML_(dinfo_zalloc)( const HChar* cc, SizeT szB );
42 void   ML_(dinfo_free)( void* v );
43 UChar* ML_(dinfo_strdup)( const HChar* cc, const UChar* str );
44 UChar* ML_(dinfo_memdup)( const HChar* cc, UChar* str, SizeT nStr );
45
46 /* Extract (possibly unaligned) data of various sizes from a buffer. */
47 Short ML_(read_Short)( UChar* data );
48 Int ML_(read_Int)( UChar* data );
49 Long ML_(read_Long)( UChar* data );
50 UShort ML_(read_UShort)( UChar* data );
51 UWord ML_(read_UWord)( UChar* data );
52 UInt ML_(read_UInt)( UChar* data );
53 ULong ML_(read_ULong)( UChar* data );
54 UChar ML_(read_UChar)( UChar* data );
55 Addr ML_(read_Addr)( UChar* data );
56
57 UChar* ML_(write_UShort)( UChar* ptr, UShort val );
58 UChar* ML_(write_UInt)( UChar* ptr, UInt val );
59 UChar* ML_(write_ULong)( UChar* ptr, ULong val );
60 UChar* ML_(write_UChar)( UChar* ptr, UChar val );
61 UChar* ML_(write_Addr)( UChar* ptr, Addr val );
62
63 /* A handy type, a la Haskell's Maybe type.  Yes, I know, C sucks.
64    Been there.  Done that.  Seen the movie.  Got the T-shirt.  Etc. */
65 typedef struct { ULong ul; Bool b; } MaybeULong;
66
67
68 #endif /* ndef __PRIV_MISC_H */
69
70 /*--------------------------------------------------------------------*/
71 /*--- end                                              priv_misc.h ---*/
72 /*--------------------------------------------------------------------*/