]> git.draconx.ca Git - gob-dx.git/blobdiff - src/checks.c
Release 0.93.1
[gob-dx.git] / src / checks.c
index 73b10d88b3aa20beb1f3f05fdfa5064a20da8a97..f2bb05885f1acec246bee6d83712acf692b71429 100644 (file)
@@ -146,10 +146,11 @@ check_duplicate_named(Class *c,Node *node,char *id, int line_no)
                        continue;
                if(n==node ||
                   line_no>=nline_no ||
-                  strcmp(nid,id)!=0)
+                  g_strcasecmp(nid,id)!=0)
                        continue;
                s = g_strdup_printf("named symbol (argument or signal) '%s' "
-                                   "redefined, first defined on line %d",
+                                   "redefined, first defined on line %d "
+                                   "(case insensitive)",
                                    id,line_no);
                print_error(FALSE,s,nline_no);
        }
@@ -242,14 +243,14 @@ check_firstarg(Class *c)
 void
 check_nonvoidempty(Class *c)
 {
-       GList *l;
-       for(l=c->nodes;l;l=g_list_next(l)) {
-               Node *n = l->data;
+       GList *li;
+       for(li=c->nodes; li; li=g_list_next(li)) {
+               Node *n = li->data;
                if(n->type == METHOD_NODE) {
                        Method *m = (Method *)n;
                        if(m->method != REGULAR_METHOD)
                                continue;
-                       if(!(strcmp(m->mtype->name,"void")==0 &&
+                       if(!(strcmp(m->mtype->name, "void")==0 &&
                             m->mtype->stars == 0) &&
                           !m->cbuf) {
                                print_error(TRUE,
@@ -271,9 +272,9 @@ check_nonvoidempty(Class *c)
 void
 check_signal_args(Class *c)
 {
-       GList *l;
-       for(l=c->nodes;l;l=g_list_next(l)) {
-               Node *n = l->data;
+       GList *li;
+       for(li=c->nodes; li; li=g_list_next(li)) {
+               Node *n = li->data;
                if(n->type == METHOD_NODE) {
                        Method *m = (Method *)n;
                        GList *l;
@@ -283,7 +284,7 @@ check_signal_args(Class *c)
 
                        for(l=m->gtktypes;l;l=l->next) {
                                char *s;
-                               if(get_cast(l->data,FALSE))
+                               if(get_cast(l->data, FALSE))
                                        continue;
                                s = g_strdup_printf("Unknown GTK+ type '%s' "
                                                    "among signal types",
@@ -304,7 +305,7 @@ check_argument_types(Class *c)
                if(n->type == ARGUMENT_NODE) {
                        Argument *a = (Argument *)n;
                        char *s;
-                       if(get_cast(a->gtktype,FALSE))
+                       if(get_cast(a->gtktype, FALSE))
                                continue;
                        s = g_strdup_printf("Unknown GTK+ type '%s' "
                                            "as argument type",
@@ -396,3 +397,35 @@ count_protecteds(Class *c)
        }
        return num;
 }
+
+int
+count_destructors(Class *c)
+{
+       int num = 0;
+       GList *l;
+       for(l=c->nodes;l;l=g_list_next(l)) {
+               Node *n = l->data;
+               if(n->type == VARIABLE_NODE) {
+                       Variable *v = (Variable *)n;
+                       if(v->destructor)
+                               num++;
+               }
+       }
+       return num;
+}
+
+int
+count_initializers(Class *c)
+{
+       int num = 0;
+       GList *l;
+       for(l=c->nodes;l;l=g_list_next(l)) {
+               Node *n = l->data;
+               if(n->type == VARIABLE_NODE) {
+                       Variable *v = (Variable *)n;
+                       if(v->initializer)
+                               num++;
+               }
+       }
+       return num;
+}