Revision
193
Author
kvv@apple.com
Date
2010-10-24 01:36:30 -0700 (Sun, 24 Oct 2010)

Log Message

Misc. shims.

Modified Paths

Diff

Modified: trunk/src/os_shims.h (192 => 193)


--- 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 (192 => 193)


--- 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)