[sr-dev] git:master: core: added shortcut to fixed value in fparam_t
Daniel-Constantin Mierla
miconda at gmail.com
Wed Jun 3 11:14:41 CEST 2009
Module: sip-router
Branch: master
Commit: d64c1c71e8c688b4e0e2f3c92702f143972ab806
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d64c1c71e8c688b4e0e2f3c92702f143972ab806
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Wed Jun 3 12:11:27 2009 +0300
core: added shortcut to fixed value in fparam_t
- required for PVAR fixups in K modules
---
mod_fix.c | 2 +-
sr_module.c | 3 +++
sr_module.h | 7 ++++---
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/mod_fix.c b/mod_fix.c
index ccd3744..a228e16 100644
--- a/mod_fix.c
+++ b/mod_fix.c
@@ -100,7 +100,7 @@ int fixup_regexpNL_none(void** param, int param_no); /* textops */
int ret; \
if ((ret=fixup_fp_##suffix (param, param_no))!=0) \
return ret; \
- *param=&((fparam_t*)*param)->v; \
+ *param=((fparam_t*)*param)->fixed; \
return 0; \
} \
int fixup_free_##suffix (void** param, int param_no) \
diff --git a/sr_module.c b/sr_module.c
index 81ef9b3..5220427 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -1142,6 +1142,7 @@ int fix_param(int type, void** param)
p->v.pvs=0;
goto error;
}
+ p->fixed = p->v.pvs;
break;
case FPARAM_PVE:
name.s = (char*)*param;
@@ -1154,6 +1155,8 @@ int fix_param(int type, void** param)
}
p->type = type;
+ if(p->fixed==NULL)
+ p->fixed = &p->v;
*param = (void*)p;
return 0;
diff --git a/sr_module.h b/sr_module.h
index bdf64de..0b1d74b 100644
--- a/sr_module.h
+++ b/sr_module.h
@@ -252,9 +252,9 @@ enum {
* Function parameter
*/
typedef struct fparam {
- char* orig; /* The original value */
- int type; /* Type of parameter */
- union {
+ char* orig; /* The original value */
+ int type; /* Type of parameter */
+ union {
char* asciiz; /* Zero terminated ASCII string */
struct _str str; /* pointer/len string */
int i; /* Integer value */
@@ -265,6 +265,7 @@ typedef struct fparam {
pv_spec_t* pvs; /* kamailo pseudo-vars */
pv_elem_t* pve; /* kamailo pseudo-vars in a string */
} v;
+ void *fixed;
} fparam_t;
More information about the sr-dev
mailing list