aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Caseiro <puppetmaster.e17@gmail.com>2006-02-04 13:45:25 +0100
committerPuppet_Master <puppetmaster.e17@gmail.com>2006-02-04 13:45:25 +0100
commit2f190a9fa080e49eb25df3a2bc280915655f1fb0 (patch)
treec2106438d21690b516e9965e264ed53c626eebd0
parentupdate todo list (diff)
downloadensorcel-2f190a9fa080e49eb25df3a2bc280915655f1fb0.tar.gz
Optimising code for spell_info_get ... ;)
-rw-r--r--src/ensorcel_config.h8
-rw-r--r--src/ensorcel_info_get.c20
-rw-r--r--src/ensorcel_tree_create.c2
3 files changed, 20 insertions, 10 deletions
diff --git a/src/ensorcel_config.h b/src/ensorcel_config.h
index d3fed4d..3ac7f30 100644
--- a/src/ensorcel_config.h
+++ b/src/ensorcel_config.h
@@ -19,12 +19,12 @@
#define TRUE 1
#define FALSE 0
-/* GRIMOIRE CONFIGURATION */
+/* GRIMOIRE CONFIGURATION
#define ENSORCELGRIMOIREFILE DATAPATH"grimoire"
#define ENSORCELPACKAGEFILE DATAPATH"packages"
-
-/* FOR SOURCE_MAGE
+*/
+/* FOR SOURCE_MAGE */
#define ENSORCELGRIMOIREFILE CONFSORCERYPATH"/local/grimoire"
#define ENSORCELPACKAGEFILE "/var/state/sorcery/packages"
-*/
+
#define ENSORCELDETAILSFILENAME "DETAILS"
diff --git a/src/ensorcel_info_get.c b/src/ensorcel_info_get.c
index 7f473f4..e06d9f9 100644
--- a/src/ensorcel_info_get.c
+++ b/src/ensorcel_info_get.c
@@ -65,28 +65,35 @@ Ecore_List *ensorcel_spell_info_get (Ecore_List * el_package_list, c
Ecore_List *list = NULL;
char sep = ':';
-
if (el_package_list)
{
char *line = NULL;
ecore_list_goto_first (el_package_list);
+
while ((line = ecore_list_next (el_package_list)))
{
- if (ensorcel_str_str (spell, line) == EXIT_SUCCESS)
+ if (ensorcel_str_str(spell, line) == EXIT_SUCCESS)
{
+ //printf ("BIG HEAVY DEBUG :: %s \n", line);
list = ensorcel_string_split (line, sep);
+ //printf ("I REMOVE :: %s\n",line);
+ //sleep (1);
+ ecore_list_remove(el_package_list);
break;
}
- else
- {
+ }
+ if (!list)
+ {
+ //printf ("DEBUG ================== | %s | \n", spell);
list = ecore_list_new ();
ecore_list_append (list, spell);
ecore_list_append (list, "0");
ecore_list_append (list, "-");
ecore_list_append (list, "");
- }
- }
+ ecore_list_remove (el_package_list);
+ }
+
/* VALGRIND SAYD INVALID FREE
* if (line)
* free (line);
@@ -97,6 +104,7 @@ Ecore_List *ensorcel_spell_info_get (Ecore_List * el_package_list, c
{
ensorcel_spell_details_get (list, spell_dir);
}
+ //printf('DEBUG :------------: return %p\n,list);
return (list);
}
diff --git a/src/ensorcel_tree_create.c b/src/ensorcel_tree_create.c
index c7cf7c8..6d7aec6 100644
--- a/src/ensorcel_tree_create.c
+++ b/src/ensorcel_tree_create.c
@@ -118,6 +118,8 @@ void ensorcel_spell_row_create (char *section_dir, Ensorcel_Tree_Skel * Tree_Ske
sprintf (dir, "%s/%s", section_dir, name);
el_spell_info = ensorcel_spell_info_get (el_package_list, name, dir);
+ if (!el_spell_info)
+ ensorcel_error_popup("FATAL ERROR");
if (ecore_file_is_dir (dir))
etk_tree_append_to_row (Tree_Skel->row_section, Tree_Skel->col1, name,