Commit b68e69aa authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

remove unused assignments

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