summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
c82c7a7)
Use the common function 'afb_api_is_valid_name'
instead of 'afb_apiset_valid_name'.
Change-Id: I2d761473d4aa1cd90adf1b7a2c1976e727b437fc
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
- * Checks wether 'name' is a valid API name.
- * @return 1 if valid, 0 otherwise
- */
-int afb_apiset_valid_name(const char *name)
-{
- unsigned char c;
-
- c = (unsigned char)*name;
- if (c == 0)
- /* empty names aren't valid */
- return 0;
-
- do {
- if (c < (unsigned char)'\x80') {
- switch(c) {
- default:
- if (c > ' ')
- break;
- case '"':
- case '#':
- case '%':
- case '&':
- case '\'':
- case '/':
- case '?':
- case '`':
- case '\\':
- case '\x7f':
- return 0;
- }
- }
- c = (unsigned char)*++name;
- } while(c != 0);
- return 1;
-}
-
struct afb_apiset *afb_apiset_addref(struct afb_apiset *set)
{
if (set)
struct afb_apiset *afb_apiset_addref(struct afb_apiset *set)
{
if (set)
int i, c;
/* Checks the api name */
int i, c;
/* Checks the api name */
- if (!afb_apiset_valid_name(name)) {
+ if (!afb_api_is_valid_name(name)) {
ERROR("invalid api name forbidden (name is '%s')", name);
errno = EINVAL;
goto error;
ERROR("invalid api name forbidden (name is '%s')", name);
errno = EINVAL;
goto error;