diff options
| author | J08nY | 2017-09-29 18:34:06 +0200 |
|---|---|---|
| committer | J08nY | 2017-09-29 18:34:06 +0200 |
| commit | 0c2b270e5e5934bb4426bc526e6d50d4e9720909 (patch) | |
| tree | 1f55cc2e4e886bb361067ca10068dd9c7fae8f34 /src/exhaustive | |
| parent | 73ae939ffee2c0fc027d9ac5d07b479d8e967a8c (diff) | |
| download | ecgen-0c2b270e5e5934bb4426bc526e6d50d4e9720909.tar.gz ecgen-0c2b270e5e5934bb4426bc526e6d50d4e9720909.tar.zst ecgen-0c2b270e5e5934bb4426bc526e6d50d4e9720909.zip | |
Introduce HAS_ARG(args) macro.
Diffstat (limited to 'src/exhaustive')
| -rw-r--r-- | src/exhaustive/anomalous.c | 10 | ||||
| -rw-r--r-- | src/exhaustive/arg.h | 6 | ||||
| -rw-r--r-- | src/exhaustive/exhaustive.c | 5 |
3 files changed, 9 insertions, 12 deletions
diff --git a/src/exhaustive/anomalous.c b/src/exhaustive/anomalous.c index eeda573..a0d03d3 100644 --- a/src/exhaustive/anomalous.c +++ b/src/exhaustive/anomalous.c @@ -89,10 +89,7 @@ static GEN anomalous_c(size_t i, GEN p) { } GENERATOR(anomalous_gen_field) { - if (!args) { - fprintf(err, "No args to an arged function. anomalous_field\n"); - return INT_MIN; - } + HAS_ARG(args); size_t i = *(size_t *)args->args; // find suitable prime field @@ -108,10 +105,7 @@ GENERATOR(anomalous_gen_field) { } GENERATOR(anomalous_gen_equation) { - if (!args) { - fprintf(err, "No args to an arged function. anomalous_gen_equation\n"); - return INT_MIN; - } + HAS_ARG(args); size_t i = *(size_t *)args->args; pari_sp ltop = avma; diff --git a/src/exhaustive/arg.h b/src/exhaustive/arg.h index 415008c..0b10715 100644 --- a/src/exhaustive/arg.h +++ b/src/exhaustive/arg.h @@ -10,6 +10,12 @@ #include "misc/types.h" +#define HAS_ARG(args) \ + if (!(args)) { \ + fprintf(err, "No args to an arged function. %s\n", __func__); \ + return INT_MIN; \ + } + /** * @brief * @return diff --git a/src/exhaustive/exhaustive.c b/src/exhaustive/exhaustive.c index 12ccd6e..3e39a82 100644 --- a/src/exhaustive/exhaustive.c +++ b/src/exhaustive/exhaustive.c @@ -123,10 +123,7 @@ static void exhaustive_ginit(gen_f *generators, const config_t *cfg) { } } -static void exhaustive_cinit(check_t **validators, const config_t *cfg) { - - -} +static void exhaustive_cinit(check_t **validators, const config_t *cfg) {} static void exhaustive_ainit(arg_t **argss, const config_t *cfg) { if (cfg->anomalous) { |
