Steffen Nurpmeso wrote in
<20220905215546.2vfqe%[email protected]>:
|Xabier Oneca -- xOneca wrote in
| <CACkgH73XahR89TXC9esdfnAAD6AWnHSnPqTM4Vgu==_kag1...@mail.gmail.com>:
||busybox tree has no file named "shexp-arith.h",
||> yet your patch is against that file.
||>
||> Do you see this file here?
||> https://git.busybox.net/busybox/tree/shell
||
||
||That file is added in one of his first patches a while ago. Later, he has
||sent patches fixing bugs for that unapplied patch. I think the confussion
||comes from this.
|
|v4 is an all-in-one again.
|Sorry for the many misses.
And the thing is that shexp-arith.h is for now absolutely
identical in between the code bases, which i said in my very first
mail i think, unfortunately too soon, on 08-05:
"For now" i simply copied over that shexp-arith.h unchanged, and
added compatibility shims so that arith() can use it. The
evaluator is quite fresh, maybe i can optimize it, and the way it
is done for now allows easy-most comparison. You surely could
make the object smaller if the compatibility shims would be
replaced with inline code.
It is quite a bit of work to detangle it and integrate it into the
busybox code base, notation-wise etc. Unfortunately no time for
such an optimization-only iteration round yet. But i think it is
stable now (current diff is
--- /tmp/x 2022-09-06 00:05:05.592064771 +0200
+++ /home/steffen/src/nail.git/src/mx/shexp-arith.h 2022-09-04
00:11:44.652709046 +0200
@@ -419,7 +419,7 @@ a_shexp__arith_eval(struct a_shexp_arith
/* Overflow check: since arithmetic expressions are rarely long enough
* to come near this limit, xxx laxe & fuzzy, not exact; max U32_MAX!
*/
if(su_64( i > U32_MAX || ) i >= UZ_MAX / 2 ||
- i >= ((UZ_MAX - (i a_SHEXP_ARITH_ERROR_TRACK( * 2))) /
+ i >= ((UZ_MAX - (i a_SHEXP_ARITH_ERROR_TRACK( * 2 ))) /
((su_ALIGNOF(*sasp->sas_nums) + sizeof(*sasp->sas_ops) * 2)
a_SHEXP_ARITH_ERROR_TRACK(
+ sizeof(*sasp->sas_error_track) * 2 ))
@@ -451,7 +451,7 @@ a_shexp__arith_eval(struct a_shexp_arith
ep = ++p.c; /* ++ to copy varnames in !_ARITH_ERROR cases */
i = a_shexp__arith_ws_squeeze(self, exp_buf, exp_len, ep);
varp = &ep[
-#if 0 a_SHEXP_ARITH_ERROR_TRACK( + 1)
+#if 0 a_SHEXP_ARITH_ERROR_TRACK( + 1 )
i + 1
#else
-1
@@ -703,8 +703,7 @@ junapre:
if(op == a_SHEXP_ARITH_OP_COND){
u16 x;
- x = *sasp->sas_ops_top;
- x &= a_SHEXP_ARITH_OP_FLAG_MASK;
+ x = *sasp->sas_ops_top & a_SHEXP_ARITH_OP_FLAG_MASK;
if(x & a_SHEXP_ARITH_OP_FLAG_WHITEOUT){
x ^= a_SHEXP_ARITH_OP_FLAG_WHITEOUT;
x |= a_SHEXP_ARITH_OP_FLAG_OUTER_WHITEOUT;
@@ -731,7 +730,7 @@ junapre:
sasp->sas_nums_top->sav_var = NIL;
}
- if((sasp->sas_nums_top)->sav_val == 0)
+ if(sasp->sas_nums_top->sav_val == 0)
op |= a_SHEXP_ARITH_OP_FLAG_WHITEOUT;
op |= *sasp->sas_ops_top & a_SHEXP_ARITH_OP_FLAG_MASK;
@@ -922,7 +921,7 @@ a_shexp__arith_ws_squeeze(struct a_shexp
goto jleave;
if(!(su_cs_is_space(c)
a_SHEXP_ARITH_IFS( || su_cs_find_c(ifs_ws, c) != NIL )
- ))
+ ))
break;
}
syntax nits only) which it unfortunately was not a month ago, even
though i thought it was. Let alone syntax-wise, and i do not use
a formatter (clang-format, the name of "the" old one i even have
forgotten), so this would all be handwork. But of course it could
be integrated plain in math.c as busybox-only code (now). But it
also works well in busybox like it is.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox