Solved style and declarations on py loader.
@@ -233,6 +233,7 @@ function_return function_py_interface_invoke(function func, function_impl impl,
else if (id == TYPE_STRING)
{
char * str = NULL;
+
Py_ssize_t length = 0;
#if PY_MAJOR_VERSION == 2
@@ -455,7 +456,8 @@ loader_impl_data py_loader_impl_initialize(loader_impl impl)
Py_IncRef(py_impl->main_module);
- if (py_impl->main_module != NULL) {
+ if (py_impl->main_module != NULL)
+ {
return py_impl;
}
}
@@ -473,6 +475,7 @@ int py_loader_impl_execution_path(loader_impl impl, const loader_naming_path pat
if (py_impl != NULL)
{
PyObject * system_path = PySys_GetObject("path");
+
PyObject * current_path = PyUnicode_DecodeFSDefault(path);
PyList_Append(system_path, current_path);
@@ -495,24 +498,34 @@ loader_handle py_loader_impl_load_from_files(loader_impl impl, const loader_nami
char location_path[512] = { 0 };
- for (size_t i = 0; i < size; i++)
+ size_t iterator;
+
+ /* TODO: Remove name from the interface */
+ (void)name;
+
+ for (iterator = 0; iterator < size; ++iterator)
{
- loader_path_get_name(path[i], module_name);
- PyObject* py_module_name = PyUnicode_DecodeFSDefault(module_name);
+ PyObject * py_module_name, * system_path, * current_path;
+ PyObject * module, * module_dict;
- strncpy(location_path, path[i], strlen(path[i]) - (strlen(module_name) + 3));
+ loader_path_get_name(path[iterator], module_name);
- /* ugly wave*/
+ py_module_name = PyUnicode_DecodeFSDefault(module_name);
- PyObject * system_path = PySys_GetObject("path");
- PyObject * current_path = PyUnicode_DecodeFSDefault(location_path);
+ strncpy(location_path, path[iterator], strlen(path[iterator]) - (strlen(module_name) + 3));
+
+ system_path = PySys_GetObject("path");
+
+ current_path = PyUnicode_DecodeFSDefault(location_path);
PyList_Append(system_path, current_path);
Py_DECREF(current_path);
- PyObject * module = PyImport_Import(py_module_name);
- PyObject * module_dict = PyModule_GetDict(module);
+ module = PyImport_Import(py_module_name);
+
+ module_dict = PyModule_GetDict(module);
+
PyDict_Merge(main_dict, module_dict, 0);
}
