Formatting fixes.

This commit is contained in:
Jason Evans 2016-09-26 11:00:32 -07:00
parent 11b5da7533
commit 57cddffca6

View File

@ -168,7 +168,8 @@ zone_force_unlock(malloc_zone_t *zone)
jemalloc_postfork_parent(); jemalloc_postfork_parent();
} }
static malloc_zone_t *get_default_zone() static malloc_zone_t *
get_default_zone(void)
{ {
malloc_zone_t **zones = NULL; malloc_zone_t **zones = NULL;
unsigned int num_zones = 0; unsigned int num_zones = 0;
@ -179,20 +180,22 @@ static malloc_zone_t *get_default_zone()
* if one is present (apparently enabled when malloc stack logging is * if one is present (apparently enabled when malloc stack logging is
* enabled), or the first registered zone otherwise. In practice this * enabled), or the first registered zone otherwise. In practice this
* means unless malloc stack logging is enabled, the first registered * means unless malloc stack logging is enabled, the first registered
* zone is the default. * zone is the default. So get the list of zones to get the first one,
* So get the list of zones to get the first one, instead of relying on * instead of relying on malloc_default_zone.
* malloc_default_zone. */
if (KERN_SUCCESS != malloc_get_all_zones(0, NULL,
(vm_address_t**)&zones, &num_zones)) {
/*
* Reset the value in case the failure happened after it was
* set.
*/ */
if (KERN_SUCCESS != malloc_get_all_zones(0, NULL, (vm_address_t**) &zones,
&num_zones)) {
/* Reset the value in case the failure happened after it was set. */
num_zones = 0; num_zones = 0;
} }
if (num_zones) if (num_zones)
return zones[0]; return (zones[0]);
return malloc_default_zone(); return (malloc_default_zone());
} }
JEMALLOC_ATTR(constructor) JEMALLOC_ATTR(constructor)