summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compiler.c34
-rw-r--r--types.c7
-rw-r--r--util.h105
3 files changed, 1 insertions, 145 deletions
diff --git a/compiler.c b/compiler.c
index c3f2416..85616c5 100644
--- a/compiler.c
+++ b/compiler.c
@@ -648,9 +648,6 @@ uc_compiler_declare_local(uc_compiler *compiler, uc_value_t *name, bool constant
const char *str1, *str2;
size_t i, len1, len2;
- //if (compiler->scope_depth == 0)
- // return;
-
if (locals->count >= 0x00FFFFFF) {
uc_compiler_syntax_error(compiler, 0, "Too many local variables");
@@ -1879,39 +1876,9 @@ uc_compiler_declare_local_null(uc_compiler *compiler, size_t srcpos, uc_value_t
static size_t
uc_compiler_declare_internal(uc_compiler *compiler, size_t srcpos, const char *name)
{
-#if 0
- ssize_t existing_slot;
- json_object *n;
- bool strict;
-
- n = xjs_new_string(name);
- strict = compiler->strict_declarations;
- compiler->strict_declarations = false;
- existing_slot = uc_compiler_declare_local(compiler, n, false);
- compiler->strict_declarations = strict;
-
- uc_compiler_emit_insn(compiler, srcpos, I_LNULL);
-
- if (existing_slot == -1) {
- uc_value_put(n);
-
- return uc_compiler_initialize_local(compiler);
- }
- else {
- uc_value_put(n);
-
- uc_compiler_emit_insn(compiler, 0, I_SLOC);
- uc_compiler_emit_u32(compiler, 0, existing_slot);
- uc_compiler_emit_insn(compiler, 0, I_POP);
-
- return existing_slot;
- }
-#else
uc_chunk *chunk = uc_compiler_current_chunk(compiler);
uc_locals *locals = &compiler->locals;
- //uc_compiler_emit_insn(compiler, srcpos, I_LNULL);
-
uc_vector_grow(locals);
locals->entries[locals->count].name = ucv_string_new(name);
@@ -1920,7 +1887,6 @@ uc_compiler_declare_internal(uc_compiler *compiler, size_t srcpos, const char *n
locals->entries[locals->count].from = chunk->count;
return locals->count++;
-#endif
}
static void
diff --git a/types.c b/types.c
index 520727a..b72980b 100644
--- a/types.c
+++ b/types.c
@@ -1046,13 +1046,6 @@ ucv_regexp_new(const char *pattern, bool icase, bool newline, bool global, char
return NULL;
}
- /*
- json_object_object_add(re->header.jso, "source", xjs_new_string(pattern));
- json_object_object_add(re->header.jso, "i", xjs_new_boolean(icase));
- json_object_object_add(re->header.jso, "g", xjs_new_boolean(global));
- json_object_object_add(re->header.jso, "s", xjs_new_boolean(newline));
- */
-
return &re->header;
}
diff --git a/util.h b/util.h
index c4ea087..858a3fd 100644
--- a/util.h
+++ b/util.h
@@ -36,8 +36,6 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif
-#define JSON_C_TO_STRING_STRICT (1<<31)
-
/* vector macros */
@@ -71,16 +69,7 @@
(&((vec)->entries[(vec)->count - 1]))
-/* debug helper */
-
-static inline uint32_t getrefcnt(json_object *v) {
- struct {
- enum json_type o_type;
- uint32_t _ref_count;
- } *spy = (void *)v;
-
- return spy ? spy->_ref_count : 0;
-}
+/* "failsafe" utility functions */
static inline void *xalloc(size_t size) {
void *ptr = calloc(1, size);
@@ -93,9 +82,6 @@ static inline void *xalloc(size_t size) {
return ptr;
}
-
-/* "failsafe" utility functions */
-
static inline void *xrealloc(void *ptr, size_t size) {
ptr = realloc(ptr, size);
@@ -118,95 +104,6 @@ static inline char *xstrdup(const char *s) {
return ptr;
}
-static inline json_object *xjs_new_object(void) {
- json_object *ptr = json_object_new_object();
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-static inline json_object *xjs_new_array(void) {
- json_object *ptr = json_object_new_array();
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-static inline json_object *xjs_new_array_size(int size) {
- json_object *ptr = json_object_new_array_ext(size);
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-static inline json_object *xjs_new_int64(int64_t n) {
- json_object *ptr = json_object_new_int64(n);
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-static inline json_object *xjs_new_uint64(uint64_t n) {
- json_object *ptr = json_object_new_uint64(n);
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-static inline json_object *xjs_new_string(const char *s) {
- json_object *ptr = json_object_new_string(s);
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-static inline json_object *xjs_new_string_len(const char *s, size_t len) {
- json_object *ptr = json_object_new_string_len(s, len);
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-static inline json_object *xjs_new_boolean(bool v) {
- json_object *ptr = json_object_new_boolean(v);
-
- if (!ptr) {
- fprintf(stderr, "Out of memory\n");
- abort();
- }
-
- return ptr;
-}
-
-
static inline struct json_tokener *xjs_new_tokener(void) {
struct json_tokener *tok = json_tokener_new();