svn commit: r266887 - head/sys/boot/usb

Hans Petter Selasky hselasky at FreeBSD.org
Fri May 30 14:30:53 UTC 2014


Author: hselasky
Date: Fri May 30 14:30:52 2014
New Revision: 266887
URL: http://svnweb.freebsd.org/changeset/base/266887

Log:
  Resolve issue with resolving malloc() and free() functions at linking time.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/boot/usb/bsd_kernel.h
  head/sys/boot/usb/bsd_usbloader_test.c

Modified: head/sys/boot/usb/bsd_kernel.h
==============================================================================
--- head/sys/boot/usb/bsd_kernel.h	Fri May 30 14:05:31 2014	(r266886)
+++ head/sys/boot/usb/bsd_kernel.h	Fri May 30 14:30:52 2014	(r266887)
@@ -430,7 +430,6 @@ size_t	strlen(const char *s);
 
 /* MALLOC API */
 
-#ifndef HAVE_MALLOC
 #undef malloc
 #define	malloc(s,x,f) usb_malloc(s)
 void   *usb_malloc(size_t);
@@ -438,15 +437,6 @@ void   *usb_malloc(size_t);
 #undef free
 #define	free(p,x) usb_free(p)
 void	usb_free(void *);
-#else
-#undef malloc
-void *malloc(size_t);
-#define	malloc(s,x,f) malloc(s)
-
-#undef free
-void free(void *);
-#define	free(p,x) free(p)
-#endif
 
 #define	strdup(p,x) usb_strdup(p)
 char   *usb_strdup(const char *str);

Modified: head/sys/boot/usb/bsd_usbloader_test.c
==============================================================================
--- head/sys/boot/usb/bsd_usbloader_test.c	Fri May 30 14:05:31 2014	(r266886)
+++ head/sys/boot/usb/bsd_usbloader_test.c	Fri May 30 14:30:52 2014	(r266887)
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <stdint.h>
+#include <stdlib.h>
 #include <time.h>
 
 extern int usleep(int);
@@ -36,6 +37,18 @@ extern void usb_uninit(void);
 
 #define	hz 1000
 
+void *
+usb_malloc(size_t size)
+{
+	return (malloc(size));
+}
+
+void
+usb_free(void *ptr)
+{
+	free(ptr);
+}
+
 void
 DELAY(unsigned int delay)
 {


More information about the svn-src-all mailing list