m->cbuf)) {
/* add unique ID */
char *s = g_strdup_printf("___%x_", (guint)m->unique_id);
- out_addline_infile(out, m->line_no);
+ if (m->line_no > 0)
+ out_addline_infile(out, m->line_no);
print_method(out, "static ", s, "", " ", "",
no_gnu?";\n":" G_GNUC_UNUSED;\n",
m, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
- out_addline_outfile(out);
+ if (m->line_no > 0)
+ out_addline_outfile(out);
g_free(s);
} else if(m->scope == PRIVATE_SCOPE ||
m->method == INIT_METHOD ||
m->method == CONSTRUCTOR_METHOD ||
m->method == DISPOSE_METHOD ||
m->method == FINALIZE_METHOD) {
- out_addline_infile(out, m->line_no);
+ if (m->line_no > 0)
+ out_addline_infile(out, m->line_no);
print_method(out, "static ", "", "", " ", "",
no_gnu?";\n":" G_GNUC_UNUSED;\n",
m, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE);
- out_addline_outfile(out);
+ if (m->line_no > 0)
+ out_addline_outfile(out);
}
}
if(v->destructor_line > 0)
out_addline_outfile(out);
- out_printf(out, "\tmemset(&%s, 0, sizeof(%s));\n",
+ out_printf(out, "\tmemset(&(%s), 0, sizeof(%s));\n",
v->id, v->id);
out_printf(out, "#undef VAR\n");
out_printf(out, "#undef %s\n", v->id);
"#undef __GOB_FUNCTION__\n\n");
}
+static void
+print_unreftors (Class *c)
+{
+ GList *li;
+ for(li = ((Class *)class)->nodes;
+ li != NULL;
+ li = li->next) {
+ Node *n = li->data;
+ Variable *v = (Variable *)n;
+ if (n->type == VARIABLE_NODE &&
+ v->scope != CLASS_SCOPE &&
+ v->destructor_unref)
+ print_destructor (v);
+ }
+}
+
static void
add_dispose (Class *c)
{
}
if (dispose_handler != NULL) {
+ if (unreftors > 0) {
+ print_unreftors (c);
+ }
+
/* so we get possible bad argument warning */
if (dispose_handler->line_no > 0)
out_addline_infile (out, dispose_handler->line_no);
out_addline_outfile (out);
}
+ if (unreftors > 0) {
+ print_unreftors (c);
+ }
+
out_printf (out,
"\tif (G_OBJECT_CLASS (parent_class)->dispose) \\\n"
"\t\t(* G_OBJECT_CLASS (parent_class)->dispose) (obj_self);\n");
}
- if (unreftors > 0) {
- GList *li;
- for(li = ((Class *)class)->nodes;
- li != NULL;
- li = li->next) {
- Node *n = li->data;
- Variable *v = (Variable *)n;
- if (n->type == VARIABLE_NODE &&
- v->scope != CLASS_SCOPE &&
- v->destructor_unref)
- print_destructor (v);
- }
- }
-
out_printf(out, "}\n"
"#undef __GOB_FUNCTION__\n\n");
}
+static void
+print_destructors (Class *c)
+{
+ GList *li;
+ for (li = ((Class *)class)->nodes;
+ li != NULL;
+ li = li->next) {
+ Node *n = li->data;
+ Variable *v = (Variable *)n;
+ if (n->type == VARIABLE_NODE &&
+ v->scope != CLASS_SCOPE &&
+ ! v->destructor_unref)
+ print_destructor (v);
+ }
+}
+
static void
add_finalize (Class *c)
{
}
if(finalize_handler) {
+ if (destructors > 0) {
+ print_destructors (c);
+ }
+
/* so we get possible bad argument warning */
if(finalize_handler->line_no > 0)
out_addline_infile(out, finalize_handler->line_no);
out_addline_outfile (out);
}
+ if (destructors > 0) {
+ print_destructors (c);
+ }
+
out_printf(out,
"\tif(G_OBJECT_CLASS(parent_class)->finalize) \\\n"
"\t\t(* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);\n");
}
- if (destructors > 0) {
- GList *li;
- for (li = ((Class *)class)->nodes;
- li != NULL;
- li = li->next) {
- Node *n = li->data;
- Variable *v = (Variable *)n;
- if (n->type == VARIABLE_NODE &&
- v->scope != CLASS_SCOPE &&
- ! v->destructor_unref)
- print_destructor (v);
- }
- }
-
out_printf(out, "}\n"
"#undef __GOB_FUNCTION__\n\n");
}
p = g_strconcat(filebase, sep, "private.h", NULL);
if( ! g_list_find_custom(include_files, p,
(GCompareFunc)strcmp)) {
- out_printf(out, "#include \"%s%cprivate.h\"\n\n",
+ out_printf(out, "#include \"%s%sprivate.h\"\n\n",
filebase,
- file_sep);
+ sep);
if(found_header)
error_printf(GOB_WARN, 0,
"Implicit private header include "