aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog7
-rw-r--r--include/memory.h44
-rw-r--r--include/mpi.h2
3 files changed, 28 insertions, 25 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 610829636..0f748a992 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,10 @@
+2005-07-27 Werner Koch <[email protected]>
+
+ * 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 <[email protected]>
* http.h: Fix prototypes for http_open_document and http_open
diff --git a/include/memory.h b/include/memory.h
index 029c89ebb..895d8a771 100644
--- a/include/memory.h
+++ b/include/memory.h
@@ -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*/
diff --git a/include/mpi.h b/include/mpi.h
index f8588cc9d..bec37ce6c 100644
--- a/include/mpi.h
+++ b/include/mpi.h
@@ -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 */
};