зеркало из https://github.com/github/ruby.git
* transcode.c (rb_econv_open0): num_encoders and num_decoders removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6eef0808a5
Коммит
4fcb83c06c
|
@ -1,3 +1,7 @@
|
|||
Tue Sep 9 20:18:26 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* transcode.c (rb_econv_open0): num_encoders and num_decoders removed.
|
||||
|
||||
Tue Sep 9 03:59:13 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* io.c (make_writeconv): useless branch removed.
|
||||
|
|
24
transcode.c
24
transcode.c
|
@ -891,11 +891,6 @@ rb_econv_open0(const char *sname, const char *dname, int ecflags)
|
|||
rb_encoding *senc, *denc;
|
||||
int sidx, didx;
|
||||
|
||||
int num_encoders, num_decoders;
|
||||
|
||||
num_encoders = 0;
|
||||
num_decoders = 0;
|
||||
|
||||
senc = NULL;
|
||||
if (*sname) {
|
||||
sidx = rb_enc_find_index(sname);
|
||||
|
@ -914,23 +909,20 @@ rb_econv_open0(const char *sname, const char *dname, int ecflags)
|
|||
|
||||
if (*sname == '\0' && *dname == '\0') {
|
||||
num_trans = 0;
|
||||
entries = ALLOC_N(transcoder_entry_t *, num_encoders+num_decoders);
|
||||
entries = NULL;
|
||||
}
|
||||
else {
|
||||
struct trans_open_t toarg;
|
||||
toarg.entries = NULL;
|
||||
toarg.num_additional = num_encoders+num_decoders;
|
||||
toarg.num_additional = 0;
|
||||
num_trans = transcode_search_path(sname, dname, trans_open_i, (void *)&toarg);
|
||||
entries = toarg.entries;
|
||||
if (num_trans < 0) {
|
||||
xfree(entries);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_trans < 0 || !entries) {
|
||||
xfree(entries);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
num_trans += num_encoders + num_decoders;
|
||||
|
||||
ec = rb_econv_open_by_transcoder_entries(num_trans, entries);
|
||||
xfree(entries);
|
||||
if (!ec)
|
||||
|
@ -940,12 +932,12 @@ rb_econv_open0(const char *sname, const char *dname, int ecflags)
|
|||
ec->source_encoding_name = sname;
|
||||
ec->destination_encoding_name = dname;
|
||||
|
||||
if (num_trans == num_encoders + num_decoders) {
|
||||
if (num_trans == 0) {
|
||||
ec->last_tc = NULL;
|
||||
ec->last_trans_index = -1;
|
||||
}
|
||||
else {
|
||||
ec->last_trans_index = ec->num_trans-1-num_decoders;
|
||||
ec->last_trans_index = ec->num_trans-1;
|
||||
ec->last_tc = ec->elems[ec->last_trans_index].tc;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче