registry: skip over invalid ISO639 or ISO3166 entries
[platform/upstream/libxkbcommon.git] / test / context.c
index 13d47a1..f91be54 100644 (file)
 
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <unistd.h>
+#ifdef _MSC_VER
+# include <io.h>
+# include <direct.h>
+# ifndef S_ISDIR
+#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# endif
+#else
+# include <unistd.h>
+#endif
 
 /* keeps a cache of all makedir/maketmpdir directories so we can free and
  * rmdir them in one go, see unmakedirs() */
@@ -77,8 +85,8 @@ static const char *makedir(const char *parent, const char *path)
     char *dirname;
     int err;
 
-    err = asprintf(&dirname, "%s/%s", parent, path);
-    assert(err >= 0);
+    dirname = asprintf_safe("%s/%s", parent, path);
+    assert(dirname);
     err = mkdir(dirname, 0777);
     assert(err == 0);