1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Converted all m_free to xfree etc.

This commit is contained in:
Werner Koch 2005-07-27 18:10:56 +00:00
parent cd570629b2
commit a1cdf3c75f
112 changed files with 2067 additions and 1813 deletions

View file

@ -1,3 +1,10 @@
2005-07-27 Werner Koch <wk@g10code.com>
* memory.h (m_free, m_alloc, m_realloc, m_strdup): Removed and
replaced all over by xfoo functions. This is to ease porting to
gnupg 1.9.
(xmalloc_secure) [M_DEBUG]: Correctly map to m_debug_alloc_secure.
2005-06-23 David Shaw <dshaw@jabberwocky.com>
* http.h: Fix prototypes for http_open_document and http_open

View file

@ -31,15 +31,15 @@
#else /* __riscos__ */
#define M_DBGINFO(a) "["__FILE__ ":" STR(a) "]"
#endif /* __riscos__ */
#define m_alloc(n) m_debug_alloc((n), M_DBGINFO( __LINE__ ) )
#define m_alloc_clear(n) m_debug_alloc_clear((n), M_DBGINFO(__LINE__) )
#define m_alloc_secure(n) m_debug_alloc((n), M_DBGINFO(__LINE__) )
#define m_alloc_secure_clear(n) m_debug_alloc_secure_clear((n), M_DBGINFO(__LINE__) )
#define m_realloc(n,m) m_debug_realloc((n),(m), M_DBGINFO(__LINE__) )
#define m_free(n) m_debug_free((n), M_DBGINFO(__LINE__) )
#define xmalloc(n) m_debug_alloc((n), M_DBGINFO( __LINE__ ) )
#define xmalloc_clear(n) m_debug_alloc_clear((n), M_DBGINFO(__LINE__) )
#define xmalloc_secure(n) m_debug_alloc_secure(n), M_DBGINFO(__LINE__) )
#define xmalloc_secure_clear(n) m_debug_alloc_secure_clear((n), M_DBGINFO(__LINE__) )
#define xrealloc(n,m) m_debug_realloc((n),(m), M_DBGINFO(__LINE__) )
#define xfree(n) m_debug_free((n), M_DBGINFO(__LINE__) )
#define m_check(n) m_debug_check((n), M_DBGINFO(__LINE__) )
/*#define m_copy(a) m_debug_copy((a), M_DBGINFO(__LINE__) )*/
#define m_strdup(a) m_debug_strdup((a), M_DBGINFO(__LINE__) )
#define xstrdup(a) m_debug_strdup((a), M_DBGINFO(__LINE__) )
void *m_debug_alloc( size_t n, const char *info );
void *m_debug_alloc_clear( size_t n, const char *info );
@ -52,25 +52,30 @@ void m_debug_check( const void *a, const char *info );
char *m_debug_strdup( const char *a, const char *info );
#else
void *m_alloc( size_t n );
void *m_alloc_clear( size_t n );
void *m_alloc_secure( size_t n );
void *m_alloc_secure_clear( size_t n );
void *m_realloc( void *a, size_t n );
void m_free( void *p );
void *xmalloc( size_t n );
void *xmalloc_clear( size_t n );
void *xmalloc_secure( size_t n );
void *xmalloc_secure_clear( size_t n );
void *xrealloc( void *a, size_t n );
void xfree( void *p );
void m_check( const void *a );
/*void *m_copy( const void *a );*/
char *m_strdup( const char * a);
char *xstrdup( const char * a);
#endif
size_t m_size( const void *a );
void m_print_stats(const char *prefix);
/* The follwing functions should be preferred over xmalloc_clear. */
void *xcalloc (size_t n, size_t m);
void *xcalloc_secure (size_t n, size_t m);
/*-- secmem.c --*/
int secmem_init( size_t npool );
void secmem_term( void );
void *secmem_malloc( size_t size );
void *secmem_realloc( void *a, size_t newsize );
void *secmexrealloc( void *a, size_t newsize );
void secmem_free( void *a );
int m_is_secure( const void *p );
void secmem_dump_stats(void);
@ -91,15 +96,6 @@ unsigned secmem_get_flags(void);
EXTERN_UNLESS_MAIN_MODULE int memory_debug_mode;
EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode;
/* To prepare a migration to the xmalloc suite of function as used in
1.9 we define a couple of macros. */
#define xmalloc(n) m_alloc ((n))
void *xcalloc (size_t n, size_t m);
#define xmalloc_secure(n) m_alloc_secure (n)
void *xcalloc_secure (size_t n, size_t m);
#define xrealloc(a,n) m_realloc ((a),(n))
#define xstrdup(a) m_strdup ((a))
#define xfree(a) m_free (a)
#endif /*G10_MEMORY_H*/

View file

@ -73,7 +73,7 @@ struct gcry_mpi {
int sign; /* indicates a negative number */
unsigned flags; /* bit 0: array must be allocated in secure memory space */
/* bit 1: not used */
/* bit 2: the limb is a pointer to some m_alloced data */
/* bit 2: the limb is a pointer to some xmalloced data */
mpi_limb_t *d; /* array with the limbs */
};