-
+ B48416427E71FE46868283490813E4D0A22DA9F4B17EFF706673A9B05380AE2D85EC9B183DB47EAA8AA197B7C7629EB873E63E5F8A66208BF230A794B6967FABmpi/include/memory.h(0 . 0)(1 . 105)
 1514 /* memory.h - memory allocation
 1515  * Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
 1516  *
 1517  * This file is part of GNUPG.
 1518  *
 1519  * GNUPG is free software; you can redistribute it and/or modify
 1520  * it under the terms of the GNU General Public License as published by
 1521  * the Free Software Foundation; either version 3 of the License, or
 1522  * (at your option) any later version.
 1523  *
 1524  * GNUPG is distributed in the hope that it will be useful,
 1525  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 1526  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 1527  * GNU General Public License for more details.
 1528  *
 1529  * You should have received a copy of the GNU General Public License
 1530  * along with this program; if not, see <http://www.gnu.org/licenses/>.
 1531  */
 1532 
 1533 #ifndef G10_MEMORY_H
 1534 #define G10_MEMORY_H
 1535 
 1536 #ifdef M_DEBUG
 1537 #ifndef STR
 1538 #define STR(v) #v
 1539 #endif
 1540 #ifndef __riscos__
 1541 #define M_DBGINFO(a)	    __FUNCTION__ "["__FILE__ ":"  STR(a) "]"
 1542 #else /* __riscos__ */
 1543 #define M_DBGINFO(a)	     "["__FILE__ ":"  STR(a) "]"
 1544 #endif /* __riscos__ */
 1545 #define xmalloc(n)		m_debug_alloc((n), M_DBGINFO( __LINE__ ) )
 1546 #define xtrymalloc(n)		m_debug_trymalloc ((n), M_DBGINFO( __LINE__ ))
 1547 #define xmalloc_clear(n)	m_debug_alloc_clear((n), M_DBGINFO(__LINE__) )
 1548 #define xmalloc_secure(n)	m_debug_alloc_secure(n), M_DBGINFO(__LINE__) )
 1549 #define xmalloc_secure_clear(n) m_debug_alloc_secure_clear((n), M_DBGINFO(__LINE__) )
 1550 #define xrealloc(n,m)		m_debug_realloc((n),(m), M_DBGINFO(__LINE__) )
 1551 #define xfree(n)		m_debug_free((n), M_DBGINFO(__LINE__) )
 1552 #define m_check(n)		m_debug_check((n), M_DBGINFO(__LINE__) )
 1553 /*#define m_copy(a)		  m_debug_copy((a), M_DBGINFO(__LINE__) )*/
 1554 #define xstrdup(a)		m_debug_strdup((a), M_DBGINFO(__LINE__) )
 1555 #define xtrystrdup(a)		m_debug_trystrdup((a), M_DBGINFO(__LINE__) )
 1556 
 1557 void *m_debug_alloc( size_t n, const char *info );
 1558 void *m_debug_trymalloc (size_t n, const char *info);
 1559 void *m_debug_alloc_clear( size_t n, const char *info  );
 1560 void *m_debug_alloc_secure( size_t n, const char *info	);
 1561 void *m_debug_alloc_secure_clear( size_t n, const char *info  );
 1562 void *m_debug_realloc( void *a, size_t n, const char *info  );
 1563 void m_debug_free( void *p, const char *info  );
 1564 void m_debug_check( const void *a, const char *info );
 1565 /*void *m_debug_copy( const void *a, const char *info );*/
 1566 char *m_debug_strdup( const char *a, const char *info );
 1567 char *m_debug_trystrdup (const char *a, const char *info);
 1568 
 1569 #else
 1570 void *xmalloc( size_t n );
 1571 void *xtrymalloc (size_t n);
 1572 void *xmalloc_clear( size_t n );
 1573 void *xmalloc_secure( size_t n );
 1574 void *xmalloc_secure_clear( size_t n );
 1575 void *xrealloc( void *a, size_t n );
 1576 void xfree( void *p );
 1577 void m_check( const void *a );
 1578 /*void *m_copy( const void *a );*/
 1579 char *xstrdup( const char * a);
 1580 char *xtrystrdup (const char *a);
 1581 #endif
 1582 
 1583 size_t m_size( const void *a );
 1584 void m_print_stats(const char *prefix);
 1585 
 1586 /* The follwing functions should be preferred over xmalloc_clear. */
 1587 void *xcalloc (size_t n, size_t m);
 1588 void *xcalloc_secure (size_t n, size_t m);
 1589 
 1590 
 1591 /*-- secmem.c --*/
 1592 int secmem_init( size_t npool );
 1593 void secmem_term( void );
 1594 void *secmem_malloc( size_t size );
 1595 void *secmexrealloc( void *a, size_t newsize );
 1596 void secmem_free( void *a );
 1597 int  m_is_secure( const void *p );
 1598 void secmem_dump_stats(void);
 1599 void secmem_set_flags( unsigned flags );
 1600 unsigned secmem_get_flags(void);
 1601 
 1602 
 1603 #define DBG_MEMORY    memory_debug_mode
 1604 #define DBG_MEMSTAT   memory_stat_debug_mode
 1605 
 1606 #ifndef EXTERN_UNLESS_MAIN_MODULE
 1607 #if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
 1608 #define EXTERN_UNLESS_MAIN_MODULE extern
 1609 #else
 1610 #define EXTERN_UNLESS_MAIN_MODULE 
 1611 #endif
 1612 #endif
 1613 EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode;
 1614 EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
 1615 
 1616 
 1617 
 1618 #endif /*G10_MEMORY_H*/