summarylogtreecommitdiffstats
path: root/28f9cb813016803026a0d86216bf6438e92635e8.diff
blob: 8a64a97dbc906f385737ee8826929b92e5ca38ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/src/lib/xmalloc.c b/src/lib/xmalloc.c
index 37849838e..ff55dec34 100644
--- a/src/lib/xmalloc.c
+++ b/src/lib/xmalloc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013, Raphael Manfredi
+ * Copyright (c) 2011-2019, Raphael Manfredi
  *
  *----------------------------------------------------------------------
  * This file is part of gtk-gnutella.
@@ -8803,6 +8803,24 @@ e_xrealloc(void *p, size_t size)
 	return q;
 }
 
+/**
+ * This is a GNU extension.
+ *
+ * This function is not used by gtk-gnutella but needs to be provided when
+ * we remap malloc() because some libc routines may rely on it.  When malloc()
+ * is redefined, it is critical that this usage be trapped here since our block
+ * architecture is specific.
+ * 		--RAM, 2019-11-10
+ *
+ * @return the number of usable bytes in the block of allocated memory
+ * pointed to by `p'.  If `p' is NULL, 0 is returned.
+ */
+size_t
+malloc_usable_size(void *p)
+{
+	return xallocated(p);
+}
+
 /*
  * For recent MinGW startup, we need to remap strdup() as well to make sure
  * it calls our malloc().  If we let it resolve by Microsoft's C runtime, it