Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(40)

Side by Side Diff: src/cmd/dist/buildruntime.c

Issue 5675095: code review 5675095: cmd/dist: fix pprof permissions
Patch Set: diff -r 459d037686be https://go.googlecode.com/hg/ Created 13 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/cmd/dist/buildgc.c ('k') | src/cmd/dist/goc2c.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include "a.h" 5 #include "a.h"
6 #include <stdio.h> 6 #include <stdio.h>
7 7
8 /* 8 /*
9 * Helpers for building pkg/runtime. 9 * Helpers for building pkg/runtime.
10 */ 10 */
(...skipping 13 matching lines...) Expand all
24 binit(&out); 24 binit(&out);
25 ········ 25 ········
26 bwritestr(&out, bprintf(&b, 26 bwritestr(&out, bprintf(&b,
27 "// auto generated by go tool dist\n" 27 "// auto generated by go tool dist\n"
28 "\n" 28 "\n"
29 "package runtime\n" 29 "package runtime\n"
30 "\n" 30 "\n"
31 "const defaultGoroot = `%s`\n" 31 "const defaultGoroot = `%s`\n"
32 "const theVersion = `%s`\n", goroot_final, goversion)); 32 "const theVersion = `%s`\n", goroot_final, goversion));
33 33
34 » writefile(&out, file); 34 » writefile(&out, file, 0);
35 ········ 35 ········
36 bfree(&b); 36 bfree(&b);
37 bfree(&out); 37 bfree(&out);
38 } 38 }
39 39
40 // mkzgoarch writes zgoarch_$GOARCH.go: 40 // mkzgoarch writes zgoarch_$GOARCH.go:
41 // 41 //
42 // package runtime 42 // package runtime
43 // const theGoarch = <goarch> 43 // const theGoarch = <goarch>
44 // 44 //
45 void 45 void
46 mkzgoarch(char *dir, char *file) 46 mkzgoarch(char *dir, char *file)
47 { 47 {
48 Buf b, out; 48 Buf b, out;
49 ········ 49 ········
50 binit(&b); 50 binit(&b);
51 binit(&out); 51 binit(&out);
52 ········ 52 ········
53 bwritestr(&out, bprintf(&b, 53 bwritestr(&out, bprintf(&b,
54 "// auto generated by go tool dist\n" 54 "// auto generated by go tool dist\n"
55 "\n" 55 "\n"
56 "package runtime\n" 56 "package runtime\n"
57 "\n" 57 "\n"
58 "const theGoarch = `%s`\n", goarch)); 58 "const theGoarch = `%s`\n", goarch));
59 59
60 » writefile(&out, file); 60 » writefile(&out, file, 0);
61 ········ 61 ········
62 bfree(&b); 62 bfree(&b);
63 bfree(&out); 63 bfree(&out);
64 } 64 }
65 65
66 // mkzgoos writes zgoos_$GOOS.go: 66 // mkzgoos writes zgoos_$GOOS.go:
67 // 67 //
68 // package runtime 68 // package runtime
69 // const theGoos = <goos> 69 // const theGoos = <goos>
70 // 70 //
71 void 71 void
72 mkzgoos(char *dir, char *file) 72 mkzgoos(char *dir, char *file)
73 { 73 {
74 Buf b, out; 74 Buf b, out;
75 ········ 75 ········
76 binit(&b); 76 binit(&b);
77 binit(&out); 77 binit(&out);
78 ········ 78 ········
79 bwritestr(&out, bprintf(&b, 79 bwritestr(&out, bprintf(&b,
80 "// auto generated by go tool dist\n" 80 "// auto generated by go tool dist\n"
81 "\n" 81 "\n"
82 "package runtime\n" 82 "package runtime\n"
83 "\n" 83 "\n"
84 "const theGoos = `%s`\n", goos)); 84 "const theGoos = `%s`\n", goos));
85 85
86 » writefile(&out, file); 86 » writefile(&out, file, 0);
87 ········ 87 ········
88 bfree(&b); 88 bfree(&b);
89 bfree(&out); 89 bfree(&out);
90 } 90 }
91 91
92 static struct { 92 static struct {
93 char *goarch; 93 char *goarch;
94 char *goos; 94 char *goos;
95 char *hdr; 95 char *hdr;
96 } zasmhdr[] = { 96 } zasmhdr[] = {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if(aggr && hasprefix(lines.p[i], "\t") && fields.len >= 2) { 228 if(aggr && hasprefix(lines.p[i], "\t") && fields.len >= 2) {
229 n = fields.len; 229 n = fields.len;
230 p = fields.p[n-1]; 230 p = fields.p[n-1];
231 if(p[xstrlen(p)-1] == ';') 231 if(p[xstrlen(p)-1] == ';')
232 p[xstrlen(p)-1] = '\0'; 232 p[xstrlen(p)-1] = '\0';
233 bwritestr(&out, bprintf(&b, "#define %s_%s %s\n", aggr, fields.p[n-1], fields.p[n-2])); 233 bwritestr(&out, bprintf(&b, "#define %s_%s %s\n", aggr, fields.p[n-1], fields.p[n-2]));
234 } 234 }
235 } 235 }
236 ········ 236 ········
237 // Write both to file and to workdir/zasm_GOOS_GOARCH.h. 237 // Write both to file and to workdir/zasm_GOOS_GOARCH.h.
238 » writefile(&out, file); 238 » writefile(&out, file, 0);
239 » writefile(&out, bprintf(&b, "%s/zasm_GOOS_GOARCH.h", workdir)); 239 » writefile(&out, bprintf(&b, "%s/zasm_GOOS_GOARCH.h", workdir), 0);
240 240
241 bfree(&in); 241 bfree(&in);
242 bfree(&b); 242 bfree(&b);
243 bfree(&out); 243 bfree(&out);
244 vfree(&argv); 244 vfree(&argv);
245 vfree(&lines); 245 vfree(&lines);
246 vfree(&fields); 246 vfree(&fields);
247 } 247 }
248 248
249 static char *runtimedefs[] = { 249 static char *runtimedefs[] = {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 } 327 }
328 if(skip) { 328 if(skip) {
329 if(hasprefix(p, "}")) 329 if(hasprefix(p, "}"))
330 skip = 0; 330 skip = 0;
331 continue; 331 continue;
332 } 332 }
333 ················ 333 ················
334 bwritestr(&out, p); 334 bwritestr(&out, p);
335 } 335 }
336 ········ 336 ········
337 » writefile(&out, file); 337 » writefile(&out, file, 0);
338 338
339 bfree(&in); 339 bfree(&in);
340 bfree(&b); 340 bfree(&b);
341 bfree(&out); 341 bfree(&out);
342 vfree(&argv); 342 vfree(&argv);
343 vfree(&lines); 343 vfree(&lines);
344 vfree(&fields); 344 vfree(&fields);
345 vfree(&seen); 345 vfree(&seen);
346 } 346 }
OLDNEW
« no previous file with comments | « src/cmd/dist/buildgc.c ('k') | src/cmd/dist/goc2c.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b