alloc: portability fixes

Some environments have allocation functions defined as macros, so use
non-overlapping struct member names.

Also, we need libmctp.h for the API definition of mctp_set_alloc_ops.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/alloc.c b/alloc.c
index 6315835..db16d84 100644
--- a/alloc.c
+++ b/alloc.c
@@ -2,12 +2,13 @@
 
 #include <assert.h>
 
+#include "libmctp.h"
 #include "libmctp-alloc.h"
 
 struct {
-	void	*(*alloc)(size_t);
-	void	(*free)(void *);
-	void	*(*realloc)(void *, size_t);
+	void	*(*m_alloc)(size_t);
+	void	(*m_free)(void *);
+	void	*(*m_realloc)(void *, size_t);
 } alloc_ops = {
 #ifndef MCTP_NO_DEFAULT_ALLOC
 	malloc,
@@ -19,35 +20,35 @@
 /* internal-only allocation functions */
 void *__mctp_alloc(size_t size)
 {
-	if (alloc_ops.alloc)
-		return alloc_ops.alloc(size);
-	if (alloc_ops.realloc)
-		return alloc_ops.realloc(NULL, size);
+	if (alloc_ops.m_alloc)
+		return alloc_ops.m_alloc(size);
+	if (alloc_ops.m_realloc)
+		return alloc_ops.m_realloc(NULL, size);
 	assert(0);
 }
 
 void __mctp_free(void *ptr)
 {
-	if (alloc_ops.free)
-		alloc_ops.free(ptr);
-	else if (alloc_ops.realloc)
-		alloc_ops.realloc(ptr, 0);
+	if (alloc_ops.m_free)
+		alloc_ops.m_free(ptr);
+	else if (alloc_ops.m_realloc)
+		alloc_ops.m_realloc(ptr, 0);
 	else
 		assert(0);
 }
 
 void *__mctp_realloc(void *ptr, size_t size)
 {
-	if (alloc_ops.realloc)
-		return alloc_ops.realloc(ptr, size);
+	if (alloc_ops.m_realloc)
+		return alloc_ops.m_realloc(ptr, size);
 	assert(0);
 }
 
-void mctp_set_alloc_ops(void *(*alloc)(size_t),
-		void (*free)(void *),
-		void *(realloc)(void *, size_t))
+void mctp_set_alloc_ops(void *(*m_alloc)(size_t),
+		void (*m_free)(void *),
+		void *(m_realloc)(void *, size_t))
 {
-	alloc_ops.alloc = alloc;
-	alloc_ops.free = free;
-	alloc_ops.realloc = realloc;
+	alloc_ops.m_alloc = m_alloc;
+	alloc_ops.m_free = m_free;
+	alloc_ops.m_realloc = m_realloc;
 }