diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-03-30 13:17:34 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-03-30 13:17:34 +0200 |
commit | 9aa7cd1d8d137bdb11f963af3e29ba4f421ab6b3 (patch) | |
tree | 2ca4abbddec6866be75fa51c4ed7368fadf020a1 /src/lib/irm.c | |
parent | 2ed8914deed73a558c6fbac7f107f47dc22f22d2 (diff) | |
download | ouroboros-9aa7cd1d8d137bdb11f963af3e29ba4f421ab6b3.tar.gz ouroboros-9aa7cd1d8d137bdb11f963af3e29ba4f421ab6b3.zip |
lib: fixes for instance_name
fixes wrong check, checks now use lazy evaluation
changed the order of instance_name_cpy to (dst, src)
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r-- | src/lib/irm.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c index af899d0a..644e1113 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -35,10 +35,7 @@ int irm_create_ipcp(instance_name_t * api, { irm_msg_t msg = IRM_MSG__INIT; - if (api == NULL) - return -EINVAL; - - if (ipcp_type == NULL || api == NULL) + if (api == NULL || ipcp_type == NULL || api->name == NULL) return -EINVAL; msg.code = IRM_MSG_CODE__IRM_CREATE_IPCP; @@ -59,12 +56,8 @@ int irm_destroy_ipcp(instance_name_t * api) { irm_msg_t msg = IRM_MSG__INIT; - if (api == NULL) - return -EINVAL; - - if (api->name == NULL) { + if (api == NULL || api->name == NULL) return -EINVAL; - } msg.code = IRM_MSG_CODE__IRM_DESTROY_IPCP; msg.ap_name = api->name; @@ -84,10 +77,7 @@ int irm_bootstrap_ipcp(instance_name_t * api, { irm_msg_t msg = IRM_MSG__INIT; - if (api == NULL) - return -EINVAL; - - if (api->name == NULL || conf == NULL) + if (api == NULL || api->name == NULL || conf == NULL) return -EINVAL; msg.code = IRM_MSG_CODE__IRM_BOOTSTRAP_IPCP; @@ -108,10 +98,7 @@ int irm_enroll_ipcp(instance_name_t * api, { irm_msg_t msg = IRM_MSG__INIT; - if (api == NULL) - return -EINVAL; - - if (api->name == NULL || dif_name == NULL) + if (api == NULL || api->name == NULL || dif_name == NULL) return -EINVAL; msg.code = IRM_MSG_CODE__IRM_ENROLL_IPCP; @@ -171,10 +158,8 @@ int irm_unreg_ipcp(const instance_name_t * api, { irm_msg_t msg = IRM_MSG__INIT; - if (api == NULL) - return -EINVAL; - - if (api->name == NULL || + if (api == NULL || + api->name == NULL || difs == NULL || difs_size == 0 || difs[0] == NULL) { |