Commit fc7e2827 by Rudolf

Do not redefine bit variable

parent 273b1678
Showing with 6 additions and 5 deletions
...@@ -96,6 +96,7 @@ struct tree *create_tree(FILE *file) ...@@ -96,6 +96,7 @@ struct tree *create_tree(FILE *file)
static int write_entry(struct BIT_BUFFER *bitbuf, struct tree *parent, static int write_entry(struct BIT_BUFFER *bitbuf, struct tree *parent,
unsigned char c) unsigned char c)
{ {
int bit = 0;
while (parent != NULL) { while (parent != NULL) {
struct tree *left, *right; struct tree *left, *right;
...@@ -104,27 +105,27 @@ static int write_entry(struct BIT_BUFFER *bitbuf, struct tree *parent, ...@@ -104,27 +105,27 @@ static int write_entry(struct BIT_BUFFER *bitbuf, struct tree *parent,
if (c != 0) { if (c != 0) {
if (left->ch == c) { if (left->ch == c) {
int bit = 0; bit = 0;
bb_write(bitbuf, &bit, 1); bb_write(bitbuf, &bit, 1);
break; break;
} else if (right->ch == c) { } else if (right->ch == c) {
int bit = 1; bit = 1;
bb_write(bitbuf, &bit, 1); bb_write(bitbuf, &bit, 1);
break; break;
} }
} else { } else {
if (left->left == NULL) { if (left->left == NULL) {
int bit = 0; bit = 0;
bb_write(bitbuf, &bit, 1); bb_write(bitbuf, &bit, 1);
break; break;
} else if (right->ch == c) { } else if (right->ch == c) {
int bit = 1; bit = 1;
bb_write(bitbuf, &bit, 1); bb_write(bitbuf, &bit, 1);
break; break;
} }
} }
int bit = 0; bit = 0;
bb_write(bitbuf, &bit, 1); bb_write(bitbuf, &bit, 1);
parent = left; parent = left;
......
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 sign in to comment