aboutsummaryrefslogtreecommitdiff
path: root/tcl_class.c
diff options
context:
space:
mode:
authormescalinum <mescalinum@users.sourceforge.net>2011-10-07 19:02:35 +0000
committermescalinum <mescalinum@users.sourceforge.net>2011-10-07 19:02:35 +0000
commit8d05bd5468ad535c1c54e539094a247e94520fb3 (patch)
tree457edb62365a117aa45c042b6aba7346d4283c8e /tcl_class.c
parent9547d7b0cf263cbd0448d1e018c889e117914092 (diff)
fix
svn path=/trunk/externals/loaders/tclpd/; revision=15540
Diffstat (limited to 'tcl_class.c')
-rw-r--r--tcl_class.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/tcl_class.c b/tcl_class.c
index 25af02d..b5d98d9 100644
--- a/tcl_class.c
+++ b/tcl_class.c
@@ -31,7 +31,7 @@ static inline list_node_t* list_add(list_node_t* head, const char* k, void* v)
{
list_node_t* n = (list_node_t*)malloc(sizeof(list_node_t));
n->next = head;
- n->k = k;
+ n->k = strdup(k);
n->v = v;
return n;
}
@@ -45,6 +45,7 @@ static inline list_node_t* list_remove(list_node_t* head, const char* k)
{
tmp = head;
head = head->next;
+ free(tmp->k);
free(tmp);
}
@@ -71,29 +72,17 @@ static inline void* list_get(list_node_t* head, const char* k)
while(head)
{
if(strcmp(head->k, k) == 0)
+ {
return head->v;
+ }
head = head->next;
}
+#ifdef DEBUG
+ debug_print("list_get(%lx, %s) = NULL\n", head, k);
+#endif
return (void*)0;
}
-static inline void list_print(list_node_t* head)
-{
- if(!head)
- {
- printf("NULL\n");
- return;
- }
- while(head)
- {
- printf("%s=x%8.8X", head->k, head->v);
- if(head->next) printf(", ");
- head = head->next;
- }
- printf("\n");
-}
-
-
static list_node_t* class_tbl[CLASS_TABLE_SIZE];
static list_node_t* object_tbl[OBJECT_TABLE_SIZE];