Skip to content

Commit 666b7f6

Browse files
committed
fix addtoken
1 parent d394410 commit 666b7f6

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

echeck.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,7 @@ unit *newunit(int n, int t) {
16991699
}
17001700
if (u) {
17011701
u->no = n;
1702+
u->people = 1;
17021703
u->line_no = line_no;
17031704
u->order = STRDUP(order_buf);
17041705
u->region = addregion(Rx, Ry, 0);
@@ -2234,7 +2235,7 @@ void orders_for_unit(int i, unit *u) {
22342235
k++;
22352236
}
22362237
e = strchr(k, ']');
2237-
u->people += atoi(k);
2238+
u->people = atoi(k);
22382239
j = strchr(k, ',');
22392240
if (!j)
22402241
j = strchr(k, ';');
@@ -5016,14 +5017,12 @@ void addtoken(tnode *root, const char *str, int id) {
50165017
}
50175018
if (!tk) {
50185019
tk = (tnode *)calloc(1, sizeof(tnode));
5019-
if (tk) {
5020-
tk->id = -1;
5021-
tk->c = c;
5022-
tk->nexthash = root->next[lindex];
5023-
root->next[lindex] = tk;
5024-
addtoken(tk, str + 1, id);
5025-
}
5020+
tk->id = -1;
5021+
tk->c = c;
5022+
tk->nexthash = root->next[lindex];
5023+
root->next[lindex] = tk;
50265024
}
5025+
addtoken(tk, str + 1, id);
50275026
while (replace[i].str) {
50285027
if (*str == replace[i].c) {
50295028
char zText[1024];

0 commit comments

Comments
 (0)