Переглянути джерело

app_python: replace STR_PARAM with PARAM_STR

Alekzander Spiridonov 11 роки тому
батько
коміт
9ac2fe9f7f
1 змінених файлів з 6 додано та 16 видалено
  1. 6 16
      modules/app_python/python_mod.c

+ 6 - 16
modules/app_python/python_mod.c

@@ -40,9 +40,9 @@
 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 child_init(int rank);
@@ -56,9 +56,9 @@ PyThreadState *myThreadState;
 
 /** module parameters */
 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}
 };
 
@@ -95,16 +95,6 @@ static int mod_init(void)
     PyObject *sys_path, *pDir, *pModule, *pFunc, *pArgs;
     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);
     bname_src = as_asciiz(&script_name);