Fix table init.
authorAndre Noll <maan@systemlinux.org>
Wed, 26 Sep 2007 14:37:00 +0000 (16:37 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 26 Sep 2007 14:37:00 +0000 (16:37 +0200)
The previous patch introduced two instances of a bug which weren't noticed by
the compiler because attribute_table and score_table were declared as void *
pointers. Change that to struct osl_table *, and add the missing '&' operator.

void * pointers a evil.

attribute.c
score.c

index 798a6cc4889fe02c7789fe10b282891fa76bee1f..801d907ab714b254dae7415d21ccc6c675484835 100644 (file)
@@ -10,7 +10,7 @@
 #include "string.h"
 #include "net.h"
 
 #include "string.h"
 #include "net.h"
 
-static void *attribute_table;
+static struct osl_table *attribute_table;
 static int greatest_att_bitnum;
 
 /** The columns of the attribute table. */
 static int greatest_att_bitnum;
 
 /** The columns of the attribute table. */
@@ -466,7 +466,7 @@ int attribute_init(struct table_info *ti, const char *db)
 
        attribute_table_desc.dir = db;
        ti->desc = &attribute_table_desc;
 
        attribute_table_desc.dir = db;
        ti->desc = &attribute_table_desc;
-       ret = osl_open_table(ti->desc, attribute_table);
+       ret = osl_open_table(ti->desc, &attribute_table);
        greatest_att_bitnum = -1; /* no atts available */
        if (ret >= 0) {
                find_greatest_att_bitnum();
        greatest_att_bitnum = -1; /* no atts available */
        if (ret >= 0) {
                find_greatest_att_bitnum();
diff --git a/score.c b/score.c
index 515a9c9464a143756e0759835aefe36dcadbcab7..ad147bba1ef7dc9ac90fbcb30e20a267e0376160 100644 (file)
--- a/score.c
+++ b/score.c
@@ -12,7 +12,7 @@
 #include "list.h"
 #include "string.h"
 
 #include "list.h"
 #include "string.h"
 
-static void *score_table;
+static struct osl_table *score_table;
 
 static int ptr_compare(const struct osl_object *obj1, const struct osl_object *obj2)
 {
 
 static int ptr_compare(const struct osl_object *obj1, const struct osl_object *obj2)
 {
@@ -358,5 +358,5 @@ int score_init(struct table_info *ti, const char *db)
        score_table_desc.dir = db;
        ti->desc = &score_table_desc;
        ti->flags = TBLFLAG_SKIP_CREATE;
        score_table_desc.dir = db;
        ti->desc = &score_table_desc;
        ti->flags = TBLFLAG_SKIP_CREATE;
-       return osl_open_table(ti->desc, score_table);
+       return osl_open_table(ti->desc, &score_table);
 }
 }