From 50104cc32a498f7517a51c8dc93106c51c7a54b4 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Wed, 20 Apr 2011 15:44:41 +0200 Subject: Imported Upstream version 2011.03.07.1 --- src/cmd/gc/init.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src/cmd/gc/init.c') diff --git a/src/cmd/gc/init.c b/src/cmd/gc/init.c index dc073443e..af4eb0336 100644 --- a/src/cmd/gc/init.c +++ b/src/cmd/gc/init.c @@ -30,19 +30,19 @@ renameinit(Node *n) /* * hand-craft the following initialization code - * var initdone· uint8 (1) - * func Init·() (2) - * if initdone· != 0 { (3) - * if initdone· == 2 (4) + * var initdone· uint8 (1) + * func init() (2) + * if initdone· != 0 { (3) + * if initdone· == 2 (4) * return * throw(); (5) * } - * initdone. = 1; (6) + * initdone· = 1; (6) * // over all matching imported symbols - * .init·() (7) + * .init() (7) * { } (8) - * init·() // if any (9) - * initdone. = 2; (10) + * init·() // if any (9) + * initdone· = 2; (10) * return (11) * } */ @@ -79,7 +79,7 @@ anyinit(NodeList *n) // are there any imported init functions for(h=0; hlink) { - if(s->name[0] != 'I' || strncmp(s->name, "Init·", 6) != 0) + if(s->name[0] != 'i' || strcmp(s->name, "init") != 0) continue; if(s->def == N) continue; @@ -118,12 +118,7 @@ fninit(NodeList *n) // (2) maxarg = 0; - snprint(namebuf, sizeof(namebuf), "Init·"); - - // this is a botch since we need a known name to - // call the top level init function out of rt0 - if(strcmp(localpkg->name, "main") == 0) - snprint(namebuf, sizeof(namebuf), "init"); + snprint(namebuf, sizeof(namebuf), "init"); fn = nod(ODCLFUNC, N, N); initsym = lookup(namebuf); @@ -154,7 +149,7 @@ fninit(NodeList *n) // (7) for(h=0; hlink) { - if(s->name[0] != 'I' || strncmp(s->name, "Init·", 6) != 0) + if(s->name[0] != 'i' || strcmp(s->name, "init") != 0) continue; if(s->def == N) continue; -- cgit v1.2.3