summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/array.c2
-rw-r--r--src/codegen.c35
-rw-r--r--src/dump.c8
-rw-r--r--src/object.c2
-rw-r--r--src/parse.y24
-rw-r--r--src/range.c4
-rw-r--r--src/state.c2
-rw-r--r--src/string.c22
-rw-r--r--src/struct.c4
-rw-r--r--src/vm.c2
10 files changed, 13 insertions, 92 deletions
diff --git a/src/array.c b/src/array.c
index d4f5d1c5e..a358e1207 100644
--- a/src/array.c
+++ b/src/array.c
@@ -66,7 +66,7 @@ mrb_ary_new(mrb_state *mrb)
static inline void
array_copy(mrb_value *dst, const mrb_value *src, size_t size)
{
- int i;
+ size_t i;
for (i = 0; i < size; i++) {
dst[i] = src[i];
diff --git a/src/codegen.c b/src/codegen.c
index 5c3614814..5803a9c25 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -4,7 +4,6 @@
** See Copyright Notice in mruby.h
*/
-#undef CODEGEN_TEST
#define CODEGEN_DUMP
#include "mruby.h"
@@ -2538,7 +2537,7 @@ codedump(mrb_state *mrb, int n)
void
codedump_all(mrb_state *mrb, int start)
{
- int i;
+ size_t i;
for (i=start; i<mrb->irep_len; i++) {
codedump(mrb, i);
@@ -2577,35 +2576,3 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
return start;
}
-
-#ifdef CODEGEN_TEST
-int
-main()
-{
- mrb_state *mrb = mrb_open();
- int n;
-
-#if 1
- n = mrb_compile_string(mrb, "p(__FILE__)\np(__LINE__)");
-#else
- n = mrb_compile_string(mrb, "\
-def fib(n)\n\
- if n<2\n\
- n\n\
- else\n\
- fib(n-2)+fib(n-1)\n\
- end\n\
-end\n\
-p(fib(30), \"\\n\")\n\
-");
-#endif
- printf("ret: %d\n", n);
-#ifdef CODEGEN_DUMP
- codedump_all(mrb, n);
-#endif
- mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[0]), mrb_nil_value());
- mrb_close(mrb);
-
- return 0;
-}
-#endif
diff --git a/src/dump.c b/src/dump.c
index 884a9141f..e0d755c8c 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -59,7 +59,7 @@ static inline int uint16_dump(uint16_t,char*,int);
static inline int uint32_dump(uint32_t,char*,int);
static char* str_dump(char*,char*,uint16_t,int);
static uint16_t str_dump_len(char*,uint16_t, int);
-static uint32_t get_irep_header_size(mrb_state*,mrb_irep*,int);
+static uint32_t get_irep_header_size(mrb_state*,int);
static uint32_t get_iseq_block_size(mrb_state*,mrb_irep*,int);
static uint32_t get_pool_block_size(mrb_state*,mrb_irep*,int);
static uint32_t get_syms_block_size(mrb_state*,mrb_irep*,int);
@@ -202,7 +202,7 @@ str_dump_len(char *str, uint16_t len, int type)
}
static uint32_t
-get_irep_header_size(mrb_state *mrb, mrb_irep *irep, int type)
+get_irep_header_size(mrb_state *mrb, int type)
{
uint32_t size = 0;
@@ -305,7 +305,7 @@ get_irep_record_size(mrb_state *mrb, int irep_no, int type)
mrb_irep *irep = mrb->irep[irep_no];
size += DUMP_SIZE(MRB_DUMP_SIZE_OF_LONG, type); /* rlen */
- size += get_irep_header_size(mrb, irep, type);
+ size += get_irep_header_size(mrb, type);
size += get_iseq_block_size(mrb, irep, type);
size += get_pool_block_size(mrb, irep, type);
size += get_syms_block_size(mrb, irep, type);
@@ -480,7 +480,7 @@ calc_crc_section(mrb_state *mrb, mrb_irep *irep, uint16_t *crc, int section)
int result;
switch (section) {
- case DUMP_IREP_HEADER: buf_size = get_irep_header_size(mrb, irep, type); break;
+ case DUMP_IREP_HEADER: buf_size = get_irep_header_size(mrb, type); break;
case DUMP_ISEQ_BLOCK: buf_size = get_iseq_block_size(mrb, irep, type); break;
case DUMP_POOL_BLOCK: buf_size = get_pool_block_size(mrb, irep, type); break;
case DUMP_SYMS_BLOCK: buf_size = get_syms_block_size(mrb, irep, type); break;
diff --git a/src/object.c b/src/object.c
index 99034e3be..f8ebd44bc 100644
--- a/src/object.c
+++ b/src/object.c
@@ -395,7 +395,7 @@ mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t)
{
const struct types *type = builtin_types;
struct RString *s;
- int xt;
+ enum mrb_vtype xt;
xt = mrb_type(x);
if ((xt != t) || (xt == MRB_TT_DATA)) {
diff --git a/src/parse.y b/src/parse.y
index 1ca3385f5..9ee9c9bec 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -5,7 +5,6 @@
*/
%{
-#undef PARSER_TEST
#undef PARSER_DEBUG
#define YYDEBUG 1
@@ -5648,26 +5647,3 @@ parser_dump(mrb_state *mrb, node *tree, int offset)
}
#endif
}
-
-#ifdef PARSER_TEST
-int
-main()
-{
- mrb_state *mrb = mrb_open();
- int n;
-
- n = mrb_compile_string(mrb, "\
-def fib(n)\n\
- if n<2\n\
- n\n\
- else\n\
- fib(n-2)+fib(n-1)\n\
- end\n\
-end\n\
-print(fib(20), \"\\n\")\n\
-");
- printf("ret: %d\n", n);
-
- return 0;
-}
-#endif
diff --git a/src/range.c b/src/range.c
index 8633b3116..2cdc34f5c 100644
--- a/src/range.c
+++ b/src/range.c
@@ -333,7 +333,7 @@ range_to_s(mrb_state *mrb, mrb_value range)
}
static mrb_value
-inspect_range(mrb_state *mrb, mrb_value range, mrb_value dummy, int recur)
+inspect_range(mrb_state *mrb, mrb_value range, int recur)
{
mrb_value str, str2;
struct RRange *r = mrb_range_ptr(range);
@@ -368,7 +368,7 @@ inspect_range(mrb_state *mrb, mrb_value range, mrb_value dummy, int recur)
static mrb_value
range_inspect(mrb_state *mrb, mrb_value range)
{
- return inspect_range(mrb, range, range, 0);
+ return inspect_range(mrb, range, 0);
}
/* 15.2.14.4.14(x) */
diff --git a/src/state.c b/src/state.c
index e30b0cea3..53773ac89 100644
--- a/src/state.c
+++ b/src/state.c
@@ -85,7 +85,7 @@ void mrb_free_heap(mrb_state *mrb);
void
mrb_close(mrb_state *mrb)
{
- int i;
+ size_t i;
mrb_final_core(mrb);
diff --git a/src/string.c b/src/string.c
index 144c4bd2a..df74bb3c8 100644
--- a/src/string.c
+++ b/src/string.c
@@ -6,7 +6,6 @@
#include "mruby.h"
-#include <stdarg.h>
#include <string.h>
#include "mruby/string.h"
#include <ctype.h>
@@ -2854,27 +2853,6 @@ mrb_str_cat2(mrb_state *mrb, mrb_value str, const char *ptr)
return mrb_str_cat(mrb, str, ptr, strlen(ptr));
}
-static mrb_value
-mrb_str_vcatf(mrb_state *mrb, mrb_value str, const char *fmt, va_list ap)
-{
- mrb_string_value(mrb, &str);
- mrb_str_resize(mrb, str, (char*)RSTRING_END(str) - RSTRING_PTR(str));
-
- return str;
-}
-
-mrb_value
-mrb_str_catf(mrb_state *mrb, mrb_value str, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- str = mrb_str_vcatf(mrb, str, format, ap);
- va_end(ap);
-
- return str;
-}
-
mrb_value
mrb_str_append(mrb_state *mrb, mrb_value str, mrb_value str2)
{
diff --git a/src/struct.c b/src/struct.c
index 85d0fa094..1396cd728 100644
--- a/src/struct.c
+++ b/src/struct.c
@@ -463,7 +463,7 @@ mrb_struct_initialize(mrb_state *mrb, mrb_value self, mrb_value values)
}
static mrb_value
-inspect_struct(mrb_state *mrb, mrb_value s, mrb_value dummy, int recur)
+inspect_struct(mrb_state *mrb, mrb_value s, int recur)
{
const char *cn = mrb_class_name(mrb, mrb_obj_class(mrb, s));
mrb_value members, str = mrb_str_new(mrb, "#<struct ", 9);
@@ -521,7 +521,7 @@ inspect_struct(mrb_state *mrb, mrb_value s, mrb_value dummy, int recur)
static mrb_value
mrb_struct_inspect(mrb_state *mrb, mrb_value s)
{
- return inspect_struct(mrb, s, s, 0);
+ return inspect_struct(mrb, s, 0);
}
/* 15.2.18.4.9 */
diff --git a/src/vm.c b/src/vm.c
index 696b566c8..ca31f6675 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -58,7 +58,7 @@ The value below allows about 60000 recursive calls in the simplest case. */
static inline void
stack_copy(mrb_value *dst, const mrb_value *src, size_t size)
{
- int i;
+ size_t i;
for (i = 0; i < size; i++) {
dst[i] = src[i];