[sr-dev] git:master: app_python: fixed the index for params

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 20 12:29:04 CEST 2010


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Apr 20 12:18:02 2010 +0200

app_python: fixed the index for params

- params are stored from 3rd possition
- search of the exported function uses (nr_of_python_params - 1), using
  -2 is wrong and goes negative

---

 modules/app_python/python_msgobj.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/app_python/python_msgobj.c b/modules/app_python/python_msgobj.c
index 0299228..fa5fbe2 100644
--- a/modules/app_python/python_msgobj.c
+++ b/modules/app_python/python_msgobj.c
@@ -212,7 +212,7 @@ msg_call_function(msgobject *self, PyObject *args)
     if(!PyArg_ParseTuple(args, "s|ss:call_function", &fname, &arg1, &arg2))
         return NULL;
 
-    fexport = find_export_record(fname, i - 2, 0, &mod_ver);
+    fexport = find_export_record(fname, i - 1, 0, &mod_ver);
     if (fexport == NULL) {
         PyErr_SetString(PyExc_RuntimeError, "no such function");
         Py_INCREF(Py_None);
@@ -235,7 +235,7 @@ msg_call_function(msgobject *self, PyObject *args)
 
     if (fexport->v1.fixup != NULL) {
         if (i >= 3) {
-            rval = fexport->v1.fixup(&(act->val[2].u.data), 2);
+            rval = fexport->v1.fixup(&(act->val[3].u.data), 2);
             if (rval < 0) {
                 PyErr_SetString(PyExc_RuntimeError, "Error in fixup (2)");
                 Py_INCREF(Py_None);
@@ -244,7 +244,7 @@ msg_call_function(msgobject *self, PyObject *args)
             act->val[2].type = MODFIXUP_ST;
         }
         if (i >= 2) {
-            rval = fexport->v1.fixup(&(act->val[1].u.data), 1);
+            rval = fexport->v1.fixup(&(act->val[2].u.data), 1);
             if (rval < 0) {
                 PyErr_SetString(PyExc_RuntimeError, "Error in fixup (1)");
                 Py_INCREF(Py_None);
@@ -265,12 +265,12 @@ msg_call_function(msgobject *self, PyObject *args)
     init_run_actions_ctx(&ra_ctx);
     rval = do_action(&ra_ctx, act, self->msg);
 
-    if ((act->val[2].type == MODFIXUP_ST) && (act->val[2].u.data)) {
-       pkg_free(act->val[2].u.data);
+    if ((act->val[3].type == MODFIXUP_ST) && (act->val[3].u.data)) {
+       pkg_free(act->val[3].u.data);
     }
 
-    if ((act->val[1].type == MODFIXUP_ST) && (act->val[1].u.data)) {
-        pkg_free(act->val[1].u.data);
+    if ((act->val[2].type == MODFIXUP_ST) && (act->val[2].u.data)) {
+        pkg_free(act->val[2].u.data);
     }
 
     pkg_free(act);




More information about the sr-dev mailing list