mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
remove unused assignments
This commit is contained in:
+2
-6
@@ -411,8 +411,8 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
|
||||
break;
|
||||
case 's':
|
||||
{
|
||||
char **ps;
|
||||
size_t *pl;
|
||||
char **ps = 0;
|
||||
size_t *pl = 0;
|
||||
struct RString *s;
|
||||
|
||||
if (argc > i) {
|
||||
@@ -422,10 +422,6 @@ mrb_get_args(mrb_state *mrb, const char *format, ...)
|
||||
pl = va_arg(ap, size_t*);
|
||||
*pl = s->len;
|
||||
}
|
||||
else {
|
||||
*ps = "";
|
||||
*pl = 0;
|
||||
}
|
||||
i++; sp++;
|
||||
}
|
||||
break;
|
||||
|
||||
+25
-34
@@ -408,23 +408,9 @@ void
|
||||
mrb_init_exception(mrb_state *mrb)
|
||||
{
|
||||
struct RClass *e;
|
||||
struct RClass *eTypeError_class;
|
||||
struct RClass *eArgumentError_class;
|
||||
struct RClass *eIndexError_class;
|
||||
struct RClass *eRangeError_class;
|
||||
struct RClass *eNameError_class;
|
||||
struct RClass *eNoMethodError_class;
|
||||
struct RClass *eScriptError_class;
|
||||
struct RClass *eSyntaxError_class;
|
||||
struct RClass *eLoadError_class;
|
||||
struct RClass *eSystemCallError_class;
|
||||
struct RClass *eLocalJumpError_class;
|
||||
struct RClass *eRegexpError_class;
|
||||
struct RClass *eZeroDivisionError_class;
|
||||
struct RClass *eEncodingError_class;
|
||||
struct RClass *eNotImpError_class;
|
||||
struct RClass *eFloatDomainError_class;
|
||||
struct RClass *eKeyError_class;
|
||||
struct RClass *eIndexError;
|
||||
struct RClass *eRangeError;
|
||||
struct RClass *eNameError;
|
||||
|
||||
mrb->eException_class = e = mrb_define_class(mrb, "Exception", mrb->object_class); /* 15.2.22 */
|
||||
mrb_define_class_method(mrb, e, "exception", mrb_instance_new, ARGS_ANY());
|
||||
@@ -438,24 +424,29 @@ mrb_init_exception(mrb_state *mrb)
|
||||
mrb->eStandardError_class = mrb_define_class(mrb, "StandardError", mrb->eException_class); /* 15.2.23 */
|
||||
mrb->eRuntimeError_class = mrb_define_class(mrb, "RuntimeError", mrb->eStandardError_class); /* 15.2.28 */
|
||||
|
||||
eTypeError_class = mrb_define_class(mrb, "TypeError", mrb->eStandardError_class); /* 15.2.29 */
|
||||
eArgumentError_class = mrb_define_class(mrb, "ArgumentError", mrb->eStandardError_class); /* 15.2.24 */
|
||||
eIndexError_class = mrb_define_class(mrb, "IndexError", mrb->eStandardError_class); /* 15.2.33 */
|
||||
eRangeError_class = mrb_define_class(mrb, "RangeError", mrb->eStandardError_class); /* 15.2.26 */
|
||||
eNameError_class = mrb_define_class(mrb, "NameError", mrb->eStandardError_class); /* 15.2.31 */
|
||||
mrb_define_class(mrb, "TypeError", mrb->eStandardError_class); /* 15.2.29 */
|
||||
mrb_define_class(mrb, "ArgumentError", mrb->eStandardError_class); /* 15.2.24 */
|
||||
eIndexError = mrb_define_class(mrb, "IndexError", mrb->eStandardError_class); /* 15.2.33 */
|
||||
eRangeError = mrb_define_class(mrb, "RangeError", mrb->eStandardError_class); /* 15.2.26 */
|
||||
eNameError = mrb_define_class(mrb, "NameError", mrb->eStandardError_class); /* 15.2.31 */
|
||||
|
||||
eNoMethodError_class = mrb_define_class(mrb, "NoMethodError", eNameError_class); /* 15.2.32 */
|
||||
eScriptError_class = mrb_define_class(mrb, "ScriptError", mrb->eException_class); /* 15.2.37 */
|
||||
eSyntaxError_class = mrb_define_class(mrb, "SyntaxError", eScriptError_class); /* 15.2.38 */
|
||||
eLoadError_class = mrb_define_class(mrb, "LoadError", eScriptError_class); /* 15.2.39 */
|
||||
eSystemCallError_class = mrb_define_class(mrb, "SystemCallError", mrb->eStandardError_class); /* 15.2.36 */
|
||||
eLocalJumpError_class = mrb_define_class(mrb, "LocalJumpError", mrb->eStandardError_class); /* 15.2.25 */
|
||||
eRegexpError_class = mrb_define_class(mrb, "RegexpError", mrb->eStandardError_class); /* 15.2.27 */
|
||||
eZeroDivisionError_class = mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
|
||||
mrb_define_class(mrb, "NoMethodError", eNameError); /* 15.2.32 */
|
||||
// eScriptError = mrb_define_class(mrb, "ScriptError", mrb->eException_class); /* 15.2.37 */
|
||||
// mrb_define_class(mrb, "SyntaxError", eScriptError); /* 15.2.38 */
|
||||
// mrb_define_class(mrb, "LoadError", eScriptError); /* 15.2.39 */
|
||||
// mrb_define_class(mrb, "NotImplementedError", eScriptError_class);
|
||||
// mrb_define_class(mrb, "SystemCallError", mrb->eStandardError_class); /* 15.2.36 */
|
||||
mrb_define_class(mrb, "LocalJumpError", mrb->eStandardError_class); /* 15.2.25 */
|
||||
|
||||
eEncodingError_class = mrb_define_class(mrb, "EncodingError", mrb->eStandardError_class);
|
||||
eNotImpError_class = mrb_define_class(mrb, "NotImplementedError", eScriptError_class);
|
||||
#ifdef INCLUDE_REGEX
|
||||
mrb_define_class(mrb, "RegexpError", mrb->eStandardError_class); /* 15.2.27 */
|
||||
#endif
|
||||
|
||||
eFloatDomainError_class = mrb_define_class(mrb, "FloatDomainError", eRangeError_class);
|
||||
eKeyError_class = mrb_define_class(mrb, "KeyError", eIndexError_class);
|
||||
#ifdef INCLUDE_ENCODING
|
||||
mrb_define_class(mrb, "EncodingError", mrb->eStandardError_class);
|
||||
#endif
|
||||
mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
|
||||
|
||||
mrb_define_class(mrb, "FloatDomainError", eRangeError);
|
||||
mrb_define_class(mrb, "KeyError", eIndexError);
|
||||
}
|
||||
|
||||
+4
-3
@@ -116,7 +116,9 @@ load_rite_header(FILE* fp, rite_binary_header* bin_header, unsigned char* hcrc)
|
||||
{
|
||||
rite_file_header file_header;
|
||||
|
||||
fread(&file_header, 1, sizeof(file_header), fp);
|
||||
if (fread(&file_header, 1, sizeof(file_header), fp) < sizeof(file_header)) {
|
||||
return MRB_DUMP_READ_FAULT;
|
||||
}
|
||||
memcpy(bin_header->rbfi, file_header.rbfi, sizeof(file_header.rbfi));
|
||||
if (memcmp(bin_header->rbfi, RITE_FILE_IDENFIFIER, sizeof(bin_header->rbfi)) != 0) {
|
||||
return MRB_DUMP_INVALID_FILE_HEADER; //File identifier error
|
||||
@@ -142,7 +144,7 @@ load_rite_irep_record(mrb_state *mrb, RiteFILE* rfp, unsigned char* dst, uint32_
|
||||
{
|
||||
int i;
|
||||
uint32_t blocklen;
|
||||
uint16_t offset, tt, pdl, snl, clen;
|
||||
uint16_t offset, pdl, snl, clen;
|
||||
unsigned char hex2[2], hex4[4], hex8[8], hcrc[4];
|
||||
unsigned char *pStart;
|
||||
char *char_buf;
|
||||
@@ -193,7 +195,6 @@ load_rite_irep_record(mrb_state *mrb, RiteFILE* rfp, unsigned char* dst, uint32_
|
||||
for (i=0; i<blocklen; i++) {
|
||||
rite_fgets(rfp, hex2, sizeof(hex2), TRUE); //TT
|
||||
dst += hex_to_bin8(dst, hex2);
|
||||
tt = hex_to_uint8(hex2);
|
||||
rite_fgets(rfp, hex4, sizeof(hex4), TRUE); //pool data length
|
||||
pdl = hex_to_uint16(hex4);
|
||||
|
||||
|
||||
+3
-5
@@ -28,10 +28,9 @@ static void fmt_setup(char*,size_t,int,int,int,int);
|
||||
static char*
|
||||
remove_sign_bits(char *str, int base)
|
||||
{
|
||||
char *s, *t;
|
||||
|
||||
s = t = str;
|
||||
char *t;
|
||||
|
||||
t = str;
|
||||
if (base == 16) {
|
||||
while (*t == 'f') {
|
||||
t++;
|
||||
@@ -780,7 +779,7 @@ format_s:
|
||||
char sc = 0;
|
||||
long v = 0, org_v = 0;
|
||||
int base;
|
||||
int len, pos;
|
||||
int len;
|
||||
|
||||
switch (*p) {
|
||||
case 'd':
|
||||
@@ -901,7 +900,6 @@ bin_retry:
|
||||
}
|
||||
len = (int)strlen(s);
|
||||
|
||||
pos = -1;
|
||||
if (dots) {
|
||||
prec -= 2;
|
||||
width -= 2;
|
||||
|
||||
+2
-12
@@ -230,8 +230,6 @@ str_independent(mrb_value str)
|
||||
static inline void
|
||||
str_enc_copy(mrb_state *mrb, mrb_value str1, mrb_value str2)
|
||||
{
|
||||
unsigned int tmp;
|
||||
tmp = ENCODING_GET_INLINED(str2);
|
||||
mrb_enc_set_index(mrb, str1, ENCODING_GET(mrb, str2));
|
||||
}
|
||||
|
||||
@@ -1067,13 +1065,11 @@ mrb_str_to_str(mrb_state *mrb, mrb_value str)
|
||||
mrb_value
|
||||
mrb_string_value(mrb_state *mrb, mrb_value *ptr)
|
||||
{
|
||||
struct RString *ps;
|
||||
mrb_value s = *ptr;
|
||||
if (mrb_type(s) != MRB_TT_STRING) {
|
||||
s = mrb_str_to_str(mrb, s);
|
||||
*ptr = s;
|
||||
}
|
||||
ps = mrb_str_ptr(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -2449,8 +2445,7 @@ str_gsub(mrb_state *mrb, mrb_value str, mrb_int bang)
|
||||
struct re_registers *regs;
|
||||
mrb_int beg, n;
|
||||
mrb_int beg0, end0;
|
||||
mrb_int offset, blen, slen, len, last;
|
||||
int iter = 0;
|
||||
mrb_int offset, blen, len, last;
|
||||
char *sp, *cp;
|
||||
mrb_encoding *str_enc;
|
||||
|
||||
@@ -2458,7 +2453,6 @@ str_gsub(mrb_state *mrb, mrb_value str, mrb_int bang)
|
||||
switch (argc) {
|
||||
case 1:
|
||||
/*RETURN_ENUMERATOR(str, argc, argv);*/
|
||||
iter = 1;
|
||||
break;
|
||||
case 2:
|
||||
repl = argv[1];
|
||||
@@ -2480,7 +2474,6 @@ str_gsub(mrb_state *mrb, mrb_value str, mrb_int bang)
|
||||
blen = RSTRING_LEN(str) + 30;
|
||||
dest = mrb_str_buf_new(mrb, blen);
|
||||
sp = RSTRING_PTR(str);
|
||||
slen = RSTRING_LEN(str);
|
||||
cp = sp;
|
||||
str_enc = STR_ENC_GET(mrb, str);
|
||||
|
||||
@@ -3702,12 +3695,11 @@ mrb_str_sub_bang(mrb_state *mrb, mrb_value str)
|
||||
mrb_value *argv;
|
||||
int argc;
|
||||
mrb_value pat, repl;
|
||||
int iter = 0;
|
||||
long plen;
|
||||
|
||||
mrb_get_args(mrb, "*", &argv, &argc);
|
||||
if (argc == 1 && mrb_block_given_p()) {
|
||||
iter = 1;
|
||||
/* do nothing */
|
||||
}
|
||||
else if (argc == 2) {
|
||||
repl = argv[1];
|
||||
@@ -4062,7 +4054,6 @@ mrb_str_to_i(mrb_state *mrb, mrb_value self)
|
||||
double
|
||||
mrb_cstr_to_dbl(mrb_state *mrb, const char * p, int badcheck)
|
||||
{
|
||||
const char *q;
|
||||
char *end;
|
||||
double d;
|
||||
// const char *ellipsis = "";
|
||||
@@ -4074,7 +4065,6 @@ mrb_cstr_to_dbl(mrb_state *mrb, const char * p, int badcheck)
|
||||
(w = (int)(end - p), ellipsis = ""))
|
||||
|
||||
if (!p) return 0.0;
|
||||
q = p;
|
||||
while (ISSPACE(*p)) p++;
|
||||
|
||||
if (!badcheck && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
|
||||
|
||||
Reference in New Issue
Block a user