#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
+#ifdef _MSC_VER
+#include <direct.h>
+#endif
/* #define DEBUG_GCDAPROFILING */
}
static uint32_t length_of_string(const char *s) {
- return (strlen(s) + 5) / 4;
+ return (strlen(s) / 4) + 1;
}
static void write_string(const char *s) {
pathname = malloc(i + 1);
strncpy(pathname, filename, i);
pathname[i] = '\0';
+#ifdef _WIN32
+ _mkdir(pathname);
+#else
mkdir(pathname, 0750); /* some of these will fail, ignore it. */
+#endif
free(pathname);
}
}
output_file = fopen(filename, "wb");
/* gcda file, version 404*, stamp LLVM. */
+#ifdef __APPLE__
+ fwrite("adcg*204MVLL", 12, 1, output_file);
+#else
fwrite("adcg*404MVLL", 12, 1, output_file);
+#endif
#ifdef DEBUG_GCDAPROFILING
printf("llvmgcda: [%s]\n", orig_filename);