[sr-dev] git:master: core: set 'fixed' shortcut to the value for fixup_uint...

Daniel-Constantin Mierla miconda at gmail.com
Wed Jun 3 12:08:31 CEST 2009


Module: sip-router
Branch: master
Commit: 235a9c07e8527efbe36e88363fca5399ff45ff21
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=235a9c07e8527efbe36e88363fca5399ff45ff21

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Jun  3 13:02:45 2009 +0300

core: set 'fixed' shortcut to the value for fixup_uint...

- K module expect the uint value instead of pointer to it
- reported by Juha Heinannen for nathelper module

---

 sr_module.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/sr_module.c b/sr_module.c
index 5220427..fc7671e 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -1056,6 +1056,7 @@ int fix_param(int type, void** param)
 		case FPARAM_STR:
 			p->v.str.s = (char*)*param;
 			p->v.str.len = strlen(p->v.str.s);
+			p->fixed = &p->v;
 			break;
 		case FPARAM_INT:
 			s.s = (char*)*param;
@@ -1068,11 +1069,12 @@ int fix_param(int type, void** param)
 				pkg_free(p);
 				return 1;
 			}
+			p->fixed = (void*)(long)num;
 			break;
 		case FPARAM_REGEX:
 			if ((p->v.regex = pkg_malloc(sizeof(regex_t))) == 0) {
 				ERR("No memory left\n");
-			goto error;
+				goto error;
 			}
 			if (regcomp(p->v.regex, *param,
 						REG_EXTENDED|REG_ICASE|REG_NEWLINE)) {
@@ -1081,6 +1083,7 @@ int fix_param(int type, void** param)
 				ERR("Bad regular expression '%s'\n", (char*)*param);
 				goto error;
 			}
+			p->fixed = &p->v;
 			break;
 		case FPARAM_AVP:
 			name.s = (char*)*param;
@@ -1097,6 +1100,7 @@ int fix_param(int type, void** param)
 				ERR("Error while parsing attribute name\n");
 				goto error;
 			}
+			p->fixed = &p->v;
 			break;
 		case FPARAM_SELECT:
 			name.s = (char*)*param;
@@ -1111,6 +1115,7 @@ int fix_param(int type, void** param)
 				ERR("Error while parsing select identifier\n");
 				goto error;
 			}
+			p->fixed = &p->v;
 			break;
 		case FPARAM_SUBST:
 			s.s = *param;
@@ -1120,6 +1125,7 @@ int fix_param(int type, void** param)
 				ERR("Error while parsing regex substitution\n");
 				goto error;
 			}
+			p->fixed = &p->v;
 			break;
 		case FPARAM_PVS:
 			name.s = (char*)*param;
@@ -1151,12 +1157,11 @@ int fix_param(int type, void** param)
 				ERR("bad PVE format: \"%.*s\"\n", name.len, name.s);
 				goto error;
 			}
+			p->fixed = &p->v;
 			break;
 	}
 	
 	p->type = type;
-	if(p->fixed==NULL)
-		p->fixed = &p->v;
 	*param = (void*)p;
 	return 0;
 	




More information about the sr-dev mailing list