diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-04-06 15:14:11 +0200 |
| commit | 505c19580e0f43fe5224431459cacb7c21edd93d (patch) | |
| tree | 79e2634c253d60afc0cc0b2f510dc7dcbb48497b /src/cmd/gc/init.c | |
| parent | 1336a7c91e596c423a49d1194ea42d98bca0d958 (diff) | |
| download | golang-505c19580e0f43fe5224431459cacb7c21edd93d.tar.gz | |
Imported Upstream version 1upstream/1
Diffstat (limited to 'src/cmd/gc/init.c')
| -rw-r--r-- | src/cmd/gc/init.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/cmd/gc/init.c b/src/cmd/gc/init.c index 8818db08c..be402cc0c 100644 --- a/src/cmd/gc/init.c +++ b/src/cmd/gc/init.c @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +#include <u.h> +#include <libc.h> #include "go.h" /* @@ -11,21 +13,13 @@ * package and also uncallable, the name, * normally "pkg.init", is altered to "pkg.init·1". */ -Node* -renameinit(Node *n) +Sym* +renameinit(void) { - Sym *s; static int initgen; - s = n->sym; - if(s == S) - return n; - if(strcmp(s->name, "init") != 0) - return n; - snprint(namebuf, sizeof(namebuf), "init·%d", ++initgen); - s = lookup(namebuf); - return newname(s); + return lookup(namebuf); } /* @@ -123,7 +117,9 @@ fninit(NodeList *n) fn = nod(ODCLFUNC, N, N); initsym = lookup(namebuf); fn->nname = newname(initsym); + fn->nname->defn = fn; fn->nname->ntype = nod(OTFUNC, N, N); + declare(fn->nname, PFUNC); funchdr(fn); // (3) |
