|
@@ -40,9 +40,9 @@
|
|
MODULE_VERSION
|
|
MODULE_VERSION
|
|
|
|
|
|
|
|
|
|
-static str script_name = {.s = "/usr/local/etc/sip-router/handler.py", .len = 0};
|
|
|
|
-static str mod_init_fname = { .s = "mod_init", .len = 0};
|
|
|
|
-static str child_init_mname = { .s = "child_init", .len = 0};
|
|
|
|
|
|
+static str script_name = str_init("/usr/local/etc/sip-router/handler.py");
|
|
|
|
+static str mod_init_fname = str_init("mod_init");
|
|
|
|
+static str child_init_mname = str_init("child_init");
|
|
|
|
|
|
static int mod_init(void);
|
|
static int mod_init(void);
|
|
static int child_init(int rank);
|
|
static int child_init(int rank);
|
|
@@ -56,9 +56,9 @@ PyThreadState *myThreadState;
|
|
|
|
|
|
/** module parameters */
|
|
/** module parameters */
|
|
static param_export_t params[]={
|
|
static param_export_t params[]={
|
|
- {"script_name", STR_PARAM, &script_name },
|
|
|
|
- {"mod_init_function", STR_PARAM, &mod_init_fname },
|
|
|
|
- {"child_init_method", STR_PARAM, &child_init_mname },
|
|
|
|
|
|
+ {"script_name", PARAM_STR, &script_name },
|
|
|
|
+ {"mod_init_function", PARAM_STR, &mod_init_fname },
|
|
|
|
+ {"child_init_method", PARAM_STR, &child_init_mname },
|
|
{0,0,0}
|
|
{0,0,0}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -95,16 +95,6 @@ static int mod_init(void)
|
|
PyObject *sys_path, *pDir, *pModule, *pFunc, *pArgs;
|
|
PyObject *sys_path, *pDir, *pModule, *pFunc, *pArgs;
|
|
PyThreadState *mainThreadState;
|
|
PyThreadState *mainThreadState;
|
|
|
|
|
|
- if (script_name.len == 0) {
|
|
|
|
- script_name.len = strlen(script_name.s);
|
|
|
|
- }
|
|
|
|
- if (mod_init_fname.len == 0) {
|
|
|
|
- mod_init_fname.len = strlen(mod_init_fname.s);
|
|
|
|
- }
|
|
|
|
- if (child_init_mname.len == 0) {
|
|
|
|
- child_init_mname.len = strlen(child_init_mname.s);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
dname_src = as_asciiz(&script_name);
|
|
dname_src = as_asciiz(&script_name);
|
|
bname_src = as_asciiz(&script_name);
|
|
bname_src = as_asciiz(&script_name);
|
|
|
|
|