[libdispatch-changes] [193] trunk/src
source_changes at macosforge.org
source_changes at macosforge.org
Sun Oct 24 01:36:33 PDT 2010
Revision: 193
http://trac.macosforge.org/projects/libdispatch/changeset/193
Author: kvv at apple.com
Date: 2010-10-24 01:36:30 -0700 (Sun, 24 Oct 2010)
Log Message:
-----------
Misc. shims.
Modified Paths:
--------------
trunk/src/os_shims.h
trunk/src/shims/malloc_zone.h
Modified: trunk/src/os_shims.h
===================================================================
--- trunk/src/os_shims.h 2010-10-24 08:25:52 UTC (rev 192)
+++ trunk/src/os_shims.h 2010-10-24 08:36:30 UTC (rev 193)
@@ -46,6 +46,21 @@
#define FD_COPY(f, t) (void)(*(t) = *(f))
#endif
+#if TARGET_OS_WIN32
+#define bzero(ptr,len) memset((ptr), 0, (len))
+#define snprintf _snprintf
+
+inline size_t strlcpy(char *dst, const char *src, size_t size) {
+ int res = strlen(dst) + strlen(src) + 1;
+ if (size > 0) {
+ size_t n = size - 1;
+ strncpy(dst, src, n);
+ dst[n] = 0;
+ }
+ return res;
+}
+#endif
+
#include "shims/getprogname.h"
#include "shims/malloc_zone.h"
#include "shims/tsd.h"
Modified: trunk/src/shims/malloc_zone.h
===================================================================
--- trunk/src/shims/malloc_zone.h 2010-10-24 08:25:52 UTC (rev 192)
+++ trunk/src/shims/malloc_zone.h 2010-10-24 08:36:30 UTC (rev 193)
@@ -68,11 +68,13 @@
return (calloc(num_items, size));
}
+#if !TARGET_OS_WIN32
static inline void *
malloc_zone_realloc(malloc_zone_t *zone, void *ptr, size_t size)
{
return (realloc(ptr, size));
}
+#endif
static inline void
malloc_zone_free(malloc_zone_t *zone, void *ptr)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20101024/7a09b42f/attachment.html>
More information about the libdispatch-changes
mailing list