]> git.saurik.com Git - ldid.git/commitdiff
Drop dependency on minimal as we port to Impactor.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 21 Sep 2015 00:43:56 +0000 (17:43 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 21 Sep 2015 00:43:56 +0000 (17:43 -0700)
.gitmodules
ldid.cpp
minimal [deleted submodule]

index f360e2a658f79e6f23774fde13545b6a8b7aff22..c00b2da6cdc58ac3148d1355e72e055fcdbf39c7 100644 (file)
@@ -1,6 +1,3 @@
-[submodule "minimal"]
-       path = minimal
-       url = git://git.saurik.com/minimal.git
 [submodule "libplist"]
        path = libplist
        url = http://git.libimobiledevice.org/libplist.git
index 72a12fb01b68ebba6f2e74cb5b585400dfa18b19..c712039ccadc0cdd707ac20a0cc653446429953b 100644 (file)
--- a/ldid.cpp
+++ b/ldid.cpp
@@ -19,8 +19,8 @@
 **/
 /* }}} */
 
-#include "minimal/stdlib.h"
-
+#include <cstdio>
+#include <cstdlib>
 #include <cstring>
 #include <fstream>
 #include <map>
 #include <vector>
 
 #include <dlfcn.h>
+#include <errno.h>
 #include <fcntl.h>
+#include <stdbool.h>
+#include <stdint.h>
 
 #include <sys/mman.h>
 #include <sys/stat.h>
 
 #include <plist/plist.h>
 
+#define _assert___(line) \
+    #line
+#define _assert__(line) \
+    _assert___(line)
+#define _assert_(e) \
+    throw __FILE__ "(" _assert__(__LINE__) "): _assert(" e ")"
+
+#define _assert(expr) \
+    do if (!(expr)) { \
+        fprintf(stderr, "%s(%u): _assert(%s); errno=%u\n", __FILE__, __LINE__, #expr, errno); \
+        _assert_(#expr); \
+    } while (false)
+
+#define _syscall(expr) ({ \
+    __typeof__(expr) _value; \
+    do if ((long) (_value = (expr)) != -1) \
+        break; \
+    else switch (errno) { \
+        case EINTR: \
+            continue; \
+        default: \
+            _assert(false); \
+    } while (true); \
+    _value; \
+})
+
+#define _trace() \
+    fprintf(stderr, "_trace(%s:%u): %s\n", __FILE__, __LINE__, __FUNCTION__)
+
+#define _not(type) \
+    ((type) ~ (type) 0)
+
+#define _packed \
+    __attribute__((packed))
+
+template <typename Type_>
+struct Iterator_ {
+    typedef typename Type_::const_iterator Result;
+};
+
+#define _foreach(item, list) \
+    for (bool _stop(true); _stop; ) \
+        for (const __typeof__(list) &_list = (list); _stop; _stop = false) \
+            for (Iterator_<__typeof__(list)>::Result _item = _list.begin(); _item != _list.end(); ++_item) \
+                for (bool _suck(true); _suck; _suck = false) \
+                    for (const __typeof__(*_item) &item = *_item; _suck; _suck = false)
+
 struct fat_header {
     uint32_t magic;
     uint32_t nfat_arch;
diff --git a/minimal b/minimal
deleted file mode 160000 (submodule)
index e327d27..0000000
--- a/minimal
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e327d27b214753a35b03a89886c82311c96353fa