[sr-dev] git:master:f3c68a50: core: cfg - removed unreachable code

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 27 09:16:03 CEST 2017


Module: kamailio
Branch: master
Commit: f3c68a5013b5a33937dbf735453da29df75ae09e
URL: https://github.com/kamailio/kamailio/commit/f3c68a5013b5a33937dbf735453da29df75ae09e

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-27T09:03:26+02:00

core: cfg - removed unreachable code

---

Modified: src/core/cfg/cfg_select.c
Modified: src/core/cfg/cfg_struct.c

---

Diff:  https://github.com/kamailio/kamailio/commit/f3c68a5013b5a33937dbf735453da29df75ae09e.diff
Patch: https://github.com/kamailio/kamailio/commit/f3c68a5013b5a33937dbf735453da29df75ae09e.patch

---

diff --git a/src/core/cfg/cfg_select.c b/src/core/cfg/cfg_select.c
index ae8b0c8852..19b815332d 100644
--- a/src/core/cfg/cfg_select.c
+++ b/src/core/cfg/cfg_select.c
@@ -205,10 +205,6 @@ int select_cfg_var(str *res, select_t *s, struct sip_msg *msg)
 	/* use the module's handle to access the variable, so the variables
 	are read from the local config */
 	p = *(group->handle) + var->offset;
-	if (p == NULL)
-		return -1;	/* The group is not yet ready.
-				 * (Trying to read the value from the
-				 * main process that has no local configuration) */
 
 	switch (CFG_VAR_TYPE(var)) {
 	case CFG_VAR_INT:
@@ -308,10 +304,6 @@ unsigned int read_cfg_var(struct cfg_read_handle *read_handle, void **val)
 	/* use the module's handle to access the variable, so the variables
 	are read from the local config */
 	p = *(group->handle) + var->offset;
-	if (p == NULL)
-		return 0;	/* The group is not yet ready.
-				 * (Trying to read the value from the
-				 * main process that has no local configuration) */
 
 	switch (CFG_VAR_TYPE(var)) {
 	case CFG_VAR_INT:
diff --git a/src/core/cfg/cfg_struct.c b/src/core/cfg/cfg_struct.c
index 8bfe4295a3..350d49c216 100644
--- a/src/core/cfg/cfg_struct.c
+++ b/src/core/cfg/cfg_struct.c
@@ -1250,8 +1250,7 @@ int cfg_select_next(cfg_group_t *group)
 		return -1;
 	}
 
-	if (!(meta = CFG_GROUP_META(cfg_local, group)))
-		return -1;
+	meta = CFG_GROUP_META(cfg_local, group);
 
 	if (!(old_ginst = CFG_HANDLE_TO_GINST(*(group->handle)) /* the active group instance */)) {
 		LOG(L_ERR, "ERROR: cfg_select_next(): No group instance is set currently. Forgot to call cfg_select_first()?\n");




More information about the sr-dev mailing list