|
@@ -152,7 +152,6 @@ int rpn_expr_untokenize(rpn_expr_t *expr, rpn_tokenized_t *tokens, char long_op)
|
152
|
152
|
goto ret_err;
|
153
|
153
|
}
|
154
|
154
|
}
|
155
|
|
- expr->toks.tokens_sz = tokens->tokens_sz;
|
156
|
155
|
|
157
|
156
|
if(_rpn_expr_end_map(expr))
|
158
|
157
|
{
|
|
@@ -163,6 +162,20 @@ int rpn_expr_untokenize(rpn_expr_t *expr, rpn_tokenized_t *tokens, char long_op)
|
163
|
162
|
return -1;
|
164
|
163
|
}
|
165
|
164
|
|
|
165
|
+ expr->toks.tokens = malloc(sizeof(rpn_token_t)*tokens->tokens_sz);
|
|
166
|
+ if(!expr->toks.tokens)
|
|
167
|
+ {
|
|
168
|
+ snprintf(expr->err_reason, 128,
|
|
169
|
+ "Unable to allocate memory for tokens : %s",
|
|
170
|
+ strerror(errno));
|
|
171
|
+ expr->state = RPN_ERROR;
|
|
172
|
+ return -1;
|
|
173
|
+ }
|
|
174
|
+ memcpy(expr->toks.tokens, tokens->tokens,
|
|
175
|
+ sizeof(rpn_token_t)*tokens->tokens_sz);
|
|
176
|
+ expr->toks.tokens_sz = tokens->tokens_sz;
|
|
177
|
+ expr->toks.argc = tokens->argc;
|
|
178
|
+
|
166
|
179
|
expr->state = RPN_READY;
|
167
|
180
|
return 0;
|
168
|
181
|
|