chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
@@@ timeout wip
[mLib]
/
test
/
tvec-bench.c
diff --git
a/test/tvec-bench.c
b/test/tvec-bench.c
index 8c8cfdf627f5b1be4e22a5e7c67a53d6bf6f5154..7086e14e2d8b3ba4302a122bfac6a4538449d7ff 100644
(file)
--- a/
test/tvec-bench.c
+++ b/
test/tvec-bench.c
@@
-143,7
+143,6
@@
fail_timer:
*
* Arguments: @struct tvec_state *tv@ = test vector state
* @const char *var@ = variable name to set
*
* Arguments: @struct tvec_state *tv@ = test vector state
* @const char *var@ = variable name to set
- * @const struct tvec_env *env@ = environment description
* @void *ctx@ = context pointer
*
* Returns: Zero on success, @-1@ on failure.
* @void *ctx@ = context pointer
*
* Returns: Zero on success, @-1@ on failure.
@@
-158,11
+157,10
@@
fail_timer:
* environment, if there is one.
*/
* environment, if there is one.
*/
-int tvec_benchset(struct tvec_state *tv, const char *var,
- const struct tvec_env *env, void *ctx)
+int tvec_benchset(struct tvec_state *tv, const char *var, void *ctx)
{
struct tvec_benchctx *bc = ctx;
{
struct tvec_benchctx *bc = ctx;
- const struct tvec_benchenv *be =
(const struct tvec_benchenv *)env
;
+ const struct tvec_benchenv *be =
bc->be
;
const struct tvec_env *subenv = be->env;
union tvec_regval rv;
static const struct tvec_floatinfo fi = { TVFF_NOMAX, 0.0, 0.0, 0.0 };
const struct tvec_env *subenv = be->env;
union tvec_regval rv;
static const struct tvec_floatinfo fi = { TVFF_NOMAX, 0.0, 0.0, 0.0 };
@@
-170,11
+168,11
@@
int tvec_benchset(struct tvec_state *tv, const char *var,
{ "@target", -1, &tvty_float, 0, { &fi } };
if (STRCMP(var, ==, "@target")) {
{ "@target", -1, &tvty_float, 0, { &fi } };
if (STRCMP(var, ==, "@target")) {
+ if (bc->f&TVBF_SETTRG) return (tvec_dupreg(tv, var));
if (tvty_float.parse(&rv, &rd, tv)) return (-1);
if (tvty_float.parse(&rv, &rd, tv)) return (-1);
- if (bc) bc->bst->target_s = rv.f;
- return (1);
+ bc->bst->target_s = rv.f; bc->f |= TVBF_SETTRG; return (1);
} else if (subenv && subenv->set)
} else if (subenv && subenv->set)
- return (subenv->set(tv, var,
subenv,
bc->subctx));
+ return (subenv->set(tv, var, bc->subctx));
else
return (0);
}
else
return (0);
}
@@
-219,6
+217,7
@@
void tvec_benchafter(struct tvec_state *tv, void *ctx)
/* Restore the benchmark state's old target. */
bc->bst->target_s = bc->dflt_target;
/* Restore the benchmark state's old target. */
bc->bst->target_s = bc->dflt_target;
+ bc->f &= ~TVBF_SETTRG;
/* Pass the call on to the subsidiary environment. */
if (subenv && subenv->after) subenv->after(tv, bc->subctx);
/* Pass the call on to the subsidiary environment. */
if (subenv && subenv->after) subenv->after(tv, bc->subctx);
@@
-240,11
+239,10
@@
void tvec_benchteardown(struct tvec_state *tv, void *ctx)
const struct tvec_benchenv *be;
const struct tvec_env *subenv;
const struct tvec_benchenv *be;
const struct tvec_env *subenv;
- if (!bc) return;
be = bc->be; subenv = be->env;
/* Tear down any subsidiary environment. */
be = bc->be; subenv = be->env;
/* Tear down any subsidiary environment. */
- if (subenv && subenv->teardown
&& bc->subctx
)
+ if (subenv && subenv->teardown)
subenv->teardown(tv, bc->subctx);
/* If the benchmark state was temporary, then dispose of it. */
subenv->teardown(tv, bc->subctx);
/* If the benchmark state was temporary, then dispose of it. */