summaryrefslogtreecommitdiff
path: root/lib/gnutls_mem.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-12-07 11:19:53 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-12-07 11:19:53 +0000
commit8293b7b08c24d6ebd54ebb52baeced2ce818bc03 (patch)
tree9ec71394c53cb0ed4913d951a8217716f24abc1a /lib/gnutls_mem.c
parentefd797cea0202dd68c970bb089e86625089f435b (diff)
downloadgnutls-8293b7b08c24d6ebd54ebb52baeced2ce818bc03.tar.gz
Exported the more convenient gnutls_malloc() and gnutls_free() functions. Actually pointers to functions.
Diffstat (limited to 'lib/gnutls_mem.c')
-rw-r--r--lib/gnutls_mem.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/lib/gnutls_mem.c b/lib/gnutls_mem.c
index 9dea5e3451..05d204fded 100644
--- a/lib/gnutls_mem.c
+++ b/lib/gnutls_mem.c
@@ -79,8 +79,8 @@ void *ret;
}
char* _gnutls_strdup( const char* str) {
-int siz = strlen( str);
-char * ret;
+size_t siz = strlen( str);
+char* ret;
ret = gnutls_malloc( siz + 1);
if (ret == NULL)
@@ -91,3 +91,34 @@ char * ret;
return ret;
}
+
+
+#if 0
+/* don't use them. They are included for documentation.
+ */
+
+/**
+ * gnutls_malloc - Allocates and returns data
+ *
+ * This function will allocate 's' bytes data, and
+ * return a pointer to memory. This function is supposed
+ * to be used by callbacks.
+ *
+ * The allocation function used is the one set by gnutls_global_set_mem_functions().
+ *
+ **/
+void* gnutls_malloc( size_t s);
+
+/**
+ * gnutls_free - Returns a free() like function
+ * @d: pointer to memory
+ *
+ * This function will free data pointed by ptr.
+ *
+ * The deallocation function used is the one set by gnutls_global_set_mem_functions().
+ *
+ **/
+void gnutls_free( void* ptr);
+
+#endif
+