[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: clean up custom check logic
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: clean up custom check logic |
Date: |
Mon, 08 Mar 2021 22:45:50 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 1cf96cf clean up custom check logic
1cf96cf is described below
commit 1cf96cf7d70d93338b7a1d5eda6f93edb638c4f7
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Mar 8 22:45:48 2021 +0100
clean up custom check logic
---
contrib/redux.ch.json | 2 +-
contrib/redux.xx.json | 2 +-
src/reducer/anastasis_api_redux.c | 13 +++++++++---
src/reducer/validation_CH_AHV.c | 42 +++++++++++++++++++--------------------
4 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/contrib/redux.ch.json b/contrib/redux.ch.json
index 818c58d..1e0c0ce 100644
--- a/contrib/redux.ch.json
+++ b/contrib/redux.ch.json
@@ -37,7 +37,7 @@
"widget": "anastasis_gtk_ia_ahv",
"uuid" : "1da87570-ba16-4f62-8a7e-cbda92f51591",
"validation-regex":
"^(756).[0-9]{4}.[0-9]{4}.[0-9]{2}|(756)[0-9]{10}$",
- "validation-logic": "CH_AVH_check"
+ "validation-logic": "CH_AHV_check"
}
]
}
diff --git a/contrib/redux.xx.json b/contrib/redux.xx.json
index 790beba..28b60ad 100644
--- a/contrib/redux.xx.json
+++ b/contrib/redux.xx.json
@@ -37,7 +37,7 @@
"widget": "anastasis_gtk_ia_ahv",
"uuid" : "1da87570-ba16-4f62-8a7e-cbda92f51591",
"validation-regex":
"^(756).[0-9]{4}.[0-9]{4}.[0-9]{2}|(756)[0-9]{10}$",
- "validation-logic": "CH_AVH_check"
+ "validation-logic": "CH_AHV_check"
}
]
}
diff --git a/src/reducer/anastasis_api_redux.c
b/src/reducer/anastasis_api_redux.c
index f359a6a..84f9a8b 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1242,9 +1242,16 @@ enter_user_attributes (json_t *state,
{
bool (*regfun)(const char *);
- if ( (NULL != (regfun = dlsym (RTLD_DEFAULT,
- reglog))) &&
- (! regfun (attribute_value)) )
+ regfun = dlsym (RTLD_DEFAULT,
+ reglog);
+ if (NULL == regfun)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Custom validation function `%s' is not available: %s\n",
+ reglog,
+ dlerror ());
+ }
+ else if (! regfun (attribute_value))
{
ANASTASIS_redux_fail_ (cb,
cb_cls,
diff --git a/src/reducer/validation_CH_AHV.c b/src/reducer/validation_CH_AHV.c
index ba5ff9e..e6a2f25 100644
--- a/src/reducer/validation_CH_AHV.c
+++ b/src/reducer/validation_CH_AHV.c
@@ -32,28 +32,26 @@
bool
CH_AHV_check (const char *ahv_number)
{
- {
- unsigned int checknum;
- unsigned int next_ten;
- const char *pos = &ahv_number[strlen (ahv_number) - 1];
- bool phase = true;
- unsigned int calculation = 0;
+ unsigned int checknum;
+ unsigned int next_ten;
+ const char *pos = &ahv_number[strlen (ahv_number) - 1];
+ bool phase = true;
+ unsigned int calculation = 0;
- checknum = *pos - 48;
- while (pos > ahv_number)
- {
- pos--;
- if ('.' == *pos)
- continue;
- if (phase)
- calculation += ((*pos - 48) * 3);
- else
- calculation += *pos - 48;
- phase = ! phase;
- }
- /* round up to the next ten */
- next_ten = ((calculation + 9) / 10) * 10;
- calculation = next_ten - calculation;
- return (checknum == calculation);
+ checknum = *pos - 48;
+ while (pos > ahv_number)
+ {
+ pos--;
+ if ('.' == *pos)
+ continue;
+ if (phase)
+ calculation += ((*pos - 48) * 3);
+ else
+ calculation += *pos - 48;
+ phase = ! phase;
}
+ /* round up to the next ten */
+ next_ten = ((calculation + 9) / 10) * 10;
+ calculation = next_ten - calculation;
+ return (checknum == calculation);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: clean up custom check logic,
gnunet <=