]> git.saurik.com Git - cycript.git/blobdiff - sig/parse.cpp
Rewrote for-each-in in terms of let, and replaced let with with.
[cycript.git] / sig / parse.cpp
index 3452e5a3159bd2046cd332904e24b6d1fd967111..05b321373a762960cc500abb8592fac9e18dacb5 100644 (file)
 */
 /* }}} */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include "minimal/stdlib.h"
-
-#include <apr-1/apr_strings.h>
-
-#include <string.h>
-
+#include <apr_strings.h>
 #include "sig/parse.hpp"
+#include "Error.hpp"
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
 
 namespace sig {
 
@@ -160,13 +156,13 @@ struct Type *Parse_(apr_pool_t *pool, const char **name, char eos, bool named, C
 
         case '^':
             type->primitive = pointer_P;
-            if (**name == 'v') {
-                type->data.data.type = NULL;
-                ++*name;
-            } else if (**name == '"') {
+            if (**name == '"') {
                 type->data.data.type = NULL;
             } else {
                 type->data.data.type = Parse_(pool, name, eos, named, callback);
+                sig::Type *&target(type->data.data.type);
+                if (target != NULL && target->primitive == void_P)
+                    target = NULL;
             }
         break;
 
@@ -278,7 +274,7 @@ const char *Unparse(apr_pool_t *pool, struct Type *type) {
             return apr_psprintf(pool, "[%lu%s]", type->data.data.size, value);
         } break;
 
-        case pointer_P: return apr_psprintf(pool, "^%s", type->data.data.type == NULL ? "" : Unparse(pool, type->data.data.type));
+        case pointer_P: return apr_psprintf(pool, "^%s", type->data.data.type == NULL ? "v" : Unparse(pool, type->data.data.type));
         case bit_P: return apr_psprintf(pool, "b%zu", type->data.data.size);
         case char_P: return "c";
         case double_P: return "d";