Revision: 188 http://trac.macosforge.org/projects/libdispatch/changeset/188 Author: kvv@apple.com Date: 2010-02-18 00:12:34 -0800 (Thu, 18 Feb 2010) Log Message: ----------- test configure features with #if not #ifdef Modified Paths: -------------- trunk/src/shims/malloc_zone.h trunk/src/shims/time.h trunk/src/source_internal.h Modified: trunk/src/shims/malloc_zone.h =================================================================== --- trunk/src/shims/malloc_zone.h 2010-02-18 08:09:57 UTC (rev 187) +++ trunk/src/shims/malloc_zone.h 2010-02-18 08:12:34 UTC (rev 188) @@ -29,70 +29,62 @@ * Implement malloc zones as a simple wrapper around malloc(3) on systems * that don't support them. */ -#ifndef HAVE_MALLOC_CREATE_ZONE +#if !HAVE_MALLOC_CREATE_ZONE typedef void * malloc_zone_t; static inline malloc_zone_t * malloc_create_zone(size_t start_size, unsigned flags) { - - return ((void *)(-1)); + return ((malloc_zone_t *)(-1)); } static inline void malloc_destroy_zone(malloc_zone_t *zone) { - + /* No-op. */ } static inline malloc_zone_t * malloc_default_zone(void) { - - return ((void *)(-1)); + return ((malloc_zone_t *)(-1)); } static inline malloc_zone_t * malloc_zone_from_ptr(const void *ptr) { - - return ((void *)(-1)); + return ((malloc_zone_t *)(-1)); } 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_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 /* !HAVE_MALLOC_CREATE_ZONE */ #endif /* __DISPATCH_SHIMS_MALLOC_ZONE__ */ Modified: trunk/src/shims/time.h =================================================================== --- trunk/src/shims/time.h 2010-02-18 08:09:57 UTC (rev 187) +++ trunk/src/shims/time.h 2010-02-18 08:12:34 UTC (rev 188) @@ -50,7 +50,7 @@ _dispatch_host_time_data_s *const data = &_dispatch_host_time_data; dispatch_once_f(&data->pred, NULL, _dispatch_get_host_time_init); - return machtime * data->frac; + return (uint64_t)(machtime * data->frac); } static inline int64_t @@ -63,7 +63,7 @@ return nsec; } - long double big_tmp = nsec; + long double big_tmp = (long double)nsec; // Divide by tbi.numer/tbi.denom to convert nsec to Mach absolute time big_tmp /= data->frac; @@ -75,14 +75,16 @@ if (slowpath(big_tmp < INT64_MIN)) { return INT64_MIN; } - return big_tmp; + return (int64_t)big_tmp; } #endif static inline uint64_t _dispatch_absolute_time(void) { -#ifndef HAVE_MACH_ABSOLUTE_TIME +#if HAVE_MACH_ABSOLUTE_TIME + return mach_absolute_time(); +#else struct timespec ts; int ret; @@ -97,8 +99,6 @@ /* XXXRW: Some kind of overflow detection needed? */ return (ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec); -#else - return mach_absolute_time(); #endif } Modified: trunk/src/source_internal.h =================================================================== --- trunk/src/source_internal.h 2010-02-18 08:09:57 UTC (rev 187) +++ trunk/src/source_internal.h 2010-02-18 08:12:34 UTC (rev 188) @@ -147,7 +147,7 @@ extern const struct dispatch_source_type_s _dispatch_source_type_vnode; extern const struct dispatch_source_type_s _dispatch_source_type_vfs; -#ifdef HAVE_MACH +#if HAVE_MACH extern const struct dispatch_source_type_s _dispatch_source_type_mach_send; extern const struct dispatch_source_type_s _dispatch_source_type_mach_recv; #endif
participants (1)
-
source_changes@macosforge.org