#include "checks.h"
-void
+static void
check_duplicate(Class *c, Node *node, char *id, int line_no)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
char *nid;
int nline_no;
nline_no = v->line_no;
} else
continue;
- if(n==node ||
- line_no>=nline_no ||
- strcmp(nid,id)!=0 ||
+ if(n == node ||
+ line_no >= nline_no ||
+ strcmp(nid, id) != 0 ||
n->type != node->type)
continue;
s = g_strdup_printf("symbol '%s' redefined, "
"first defined on line %d",
- id,line_no);
- print_error(FALSE,s,nline_no);
+ id, line_no);
+ print_error(FALSE, s, nline_no);
}
}
check_duplicate_symbols(Class *c)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
- check_duplicate(c,n,m->id,m->line_no);
+ check_duplicate(c, n, m->id, m->line_no);
} else if(n->type == VARIABLE_NODE) {
Variable *v = (Variable *)n;
- check_duplicate(c,n,v->id,v->line_no);
+ check_duplicate(c, n, v->id, v->line_no);
}
}
}
check_bad_symbols(Class *c)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
if((m->method == SIGNAL_LAST_METHOD ||
m->method == SIGNAL_FIRST_METHOD ||
m->method == VIRTUAL_METHOD) &&
- strcmp(m->id,"__parent__")==0) {
+ strcmp(m->id, "__parent__")==0) {
char *s;
s = g_strdup_printf("'%s' not allowed as an "
"identifier of signal "
}
if(m->method != INIT_METHOD &&
m->method != CLASS_INIT_METHOD &&
- (strcmp(m->id,"init")==0 ||
- strcmp(m->id,"class_init")==0)) {
+ (strcmp(m->id, "init")==0 ||
+ strcmp(m->id, "class_init")==0)) {
print_error(FALSE,"init, or class_init not "
"allowed as an "
"identifier of non-"
- "constructor methods",m->line_no);
+ "constructor methods", m->line_no);
}
} else if(n->type == VARIABLE_NODE) {
Variable *v = (Variable *)n;
- if(strcmp(v->id,"_priv")==0 ||
- strcmp(v->id,"__parent__")==0) {
+ if(strcmp(v->id, "_priv")==0 ||
+ strcmp(v->id, "__parent__")==0) {
char *s;
s = g_strdup_printf("'%s' not allowed as a "
- "data member name",v->id);
- print_error(FALSE,s,v->line_no);
+ "data member name", v->id);
+ print_error(FALSE, s, v->line_no);
g_free(s);
}
}
}
}
-
-void
-check_duplicate_named(Class *c,Node *node,char *id, int line_no)
+static void
+check_duplicate_named(Class *c, Node *node, char *id, int line_no)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
char *nid;
int nline_no;
check_duplicate_signals_args(Class *c)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
check_public_new(Class *c)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
check_vararg(Class *c)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
check_firstarg(Class *c)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
check_nonvoidempty(Class *c)
{
GList *li;
- for(li=c->nodes; li; li=g_list_next(li)) {
+ for(li = c->nodes; li != NULL; li = g_list_next(li)) {
Node *n = li->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
check_signal_args(Class *c)
{
GList *li;
- for(li=c->nodes; li; li=g_list_next(li)) {
+ for(li = c->nodes; li != NULL; li = g_list_next(li)) {
Node *n = li->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
check_argument_types(Class *c)
{
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == ARGUMENT_NODE) {
Argument *a = (Argument *)n;
{
int num = 0;
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
{
int num = 0;
GList *li;
-
- for(li=c->nodes;li;li=g_list_next(li)) {
+ for(li = c->nodes; li != NULL; li = g_list_next(li)) {
Node *n = li->data;
if(n->type == ARGUMENT_NODE)
num ++;
{
int num = 0;
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
{
int num = 0;
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == VARIABLE_NODE) {
Variable *v = (Variable *)n;
{
int num = 0;
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == METHOD_NODE) {
Method *m = (Method *)n;
{
int num = 0;
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == VARIABLE_NODE) {
Variable *v = (Variable *)n;
{
int num = 0;
GList *l;
- for(l=c->nodes;l;l=g_list_next(l)) {
+ for(l = c->nodes; l != NULL; l = g_list_next(l)) {
Node *n = l->data;
if(n->type == VARIABLE_NODE) {
Variable *v = (Variable *)n;