[libdispatch-changes] [62] trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 28 01:47:01 PDT 2009


Revision: 62
          http://trac.macosforge.org/projects/libdispatch/changeset/62
Author:   robert at fledge.watson.org
Date:     2009-10-28 01:46:58 -0700 (Wed, 28 Oct 2009)
Log Message:
-----------
Complete migration from compat/ to src/shims/ by moving malloc_zone
compat routines there.

This is not quite identical to the submitted patch as I also updated
header guards.

Submitted by:	Paolo Bonzini <bonzini at gnu.org>

Modified Paths:
--------------
    trunk/src/internal.h
    trunk/src/os_shims.h

Added Paths:
-----------
    trunk/src/shims/malloc_zone.h

Removed Paths:
-------------
    trunk/compat/malloc_zone.h

Deleted: trunk/compat/malloc_zone.h
===================================================================
--- trunk/compat/malloc_zone.h	2009-10-28 08:32:09 UTC (rev 61)
+++ trunk/compat/malloc_zone.h	2009-10-28 08:46:58 UTC (rev 62)
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2009 Apple Inc. All rights reserved.
- *
- * @APPLE_APACHE_LICENSE_HEADER_START@
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * @APPLE_APACHE_LICENSE_HEADER_END@
- */
-
-#ifndef __COMPAT_MALLOC_ZONE_H__
-#define __COMPAT_MALLOC_ZONE_H__
-
-#include <sys/types.h>
-
-#include <stdlib.h>
-
-/*
- * Implement malloc zones as a simple wrapper around malloc(3) on systems
- * that don't support them.
- */
-typedef void * malloc_zone_t;
-
-static inline malloc_zone_t *
-malloc_create_zone(size_t start_size, unsigned flags)
-{
-
-	return (NULL);
-}
-
-static inline void
-malloc_destroy_zone(malloc_zone_t *zone)
-{
-
-}
-
-static inline malloc_zone_t *
-malloc_default_zone(void)
-{
-
-	return (NULL);
-}
-
-static inline malloc_zone_t *
-malloc_zone_from_ptr(const void *ptr)
-{
-
-	return (NULL);
-}
-
-static inline void *
-malloc_zone_malloc(malloc_zone_t *zone, size_t size)
-{
-
-	return (malloc(size));
-}
-
-static inline void *
-malloc_zone_calloc(malloc_zone_t *zone, size_t num_items, size_t size)
-{
-
-	return (calloc(num_items, size));
-}
-
-static inline void *
-malloc_zone_realloc(malloc_zone_t *zone, void *ptr, size_t size)
-{
-
-	return (realloc(ptr, size));
-}
-
-static inline void *
-malloc_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size)
-{
-	void *ptr;
-
-	if (posix_memalign(&ptr, alignment, size) < 0)
-		return (NULL);
-	return (ptr);
-}
-
-static inline void
-malloc_zone_free(malloc_zone_t *zone, void *ptr)
-{
-
-	free(ptr);
-}
-
-static inline void
-malloc_set_zone_name(malloc_zone_t *zone, const char *name)
-{
-
-	/* No-op. */
-}
-
-#endif /* __COMPAT_MALLOC_ZONE_H__ */

Modified: trunk/src/internal.h
===================================================================
--- trunk/src/internal.h	2009-10-28 08:32:09 UTC (rev 61)
+++ trunk/src/internal.h	2009-10-28 08:46:58 UTC (rev 62)
@@ -32,10 +32,6 @@
 #define __DISPATCH_BUILDING_DISPATCH__
 #define __DISPATCH_INDIRECT__
 
-#ifndef HAVE_MALLOC_CREATE_ZONE
-#include <compat/malloc_zone.h>
-#endif
-
 #ifdef HAVE_AVAILABILITY_H
 #include <Availability.h>
 #endif

Modified: trunk/src/os_shims.h
===================================================================
--- trunk/src/os_shims.h	2009-10-28 08:32:09 UTC (rev 61)
+++ trunk/src/os_shims.h	2009-10-28 08:46:58 UTC (rev 62)
@@ -46,6 +46,7 @@
 #define	FD_COPY(f, t)	(void)(*(t) = *(f))
 #endif
 
+#include "shims/malloc_zone.h"
 #include "shims/tsd.h"
 #include "shims/perfmon.h"
 #include "shims/time.h"

Copied: trunk/src/shims/malloc_zone.h (from rev 61, trunk/compat/malloc_zone.h)
===================================================================
--- trunk/src/shims/malloc_zone.h	                        (rev 0)
+++ trunk/src/shims/malloc_zone.h	2009-10-28 08:46:58 UTC (rev 62)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2009 Apple Inc. All rights reserved.
+ *
+ * @APPLE_APACHE_LICENSE_HEADER_START@
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * @APPLE_APACHE_LICENSE_HEADER_END@
+ */
+
+#ifndef __DISPATCH_SHIMS_MALLOC_ZONE__
+#define __DISPATCH_SHIMS_MALLOC_ZONE__
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+
+/*
+ * Implement malloc zones as a simple wrapper around malloc(3) on systems
+ * that don't support them.
+ */
+#ifndef HAVE_MALLOC_CREATE_ZONE
+typedef void * malloc_zone_t;
+
+static inline malloc_zone_t *
+malloc_create_zone(size_t start_size, unsigned flags)
+{
+
+	return (NULL);
+}
+
+static inline void
+malloc_destroy_zone(malloc_zone_t *zone)
+{
+
+}
+
+static inline malloc_zone_t *
+malloc_default_zone(void)
+{
+
+	return (NULL);
+}
+
+static inline malloc_zone_t *
+malloc_zone_from_ptr(const void *ptr)
+{
+
+	return (NULL);
+}
+
+static inline void *
+malloc_zone_malloc(malloc_zone_t *zone, size_t size)
+{
+
+	return (malloc(size));
+}
+
+static inline void *
+malloc_zone_calloc(malloc_zone_t *zone, size_t num_items, size_t size)
+{
+
+	return (calloc(num_items, size));
+}
+
+static inline void *
+malloc_zone_realloc(malloc_zone_t *zone, void *ptr, size_t size)
+{
+
+	return (realloc(ptr, size));
+}
+
+static inline void *
+malloc_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size)
+{
+	void *ptr;
+
+	if (posix_memalign(&ptr, alignment, size) < 0)
+		return (NULL);
+	return (ptr);
+}
+
+static inline void
+malloc_zone_free(malloc_zone_t *zone, void *ptr)
+{
+
+	free(ptr);
+}
+
+static inline void
+malloc_set_zone_name(malloc_zone_t *zone, const char *name)
+{
+
+	/* No-op. */
+}
+#endif
+
+#endif /* __DISPATCH_SHIMS_MALLOC_ZONE__ */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20091028/f75c7d3c/attachment-0001.html>


More information about the libdispatch-changes mailing list