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

Unified Diff: src/cmd/gc/mkbuiltin1.c

Issue 190076: code review 190076: cleanup toward eliminating package global name space (Closed)
Patch Set: code review 190076: cleanup toward eliminating package global name space Created 15 years, 2 months ago
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/gc/go.y ('k') | src/cmd/gc/obj.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/gc/mkbuiltin1.c
===================================================================
--- a/src/cmd/gc/mkbuiltin1.c
+++ b/src/cmd/gc/mkbuiltin1.c
@@ -10,6 +10,8 @@
#include <ctype.h>
#include <errno.h>
+void esc(char*);
+
int
main(int argc, char **argv)
{
@@ -61,12 +63,13 @@
printf("\t\"");
while(q = strstr(p, "PACKAGE")) {
*q = 0;
- printf("%s", p); // up to the substitution
+ esc(p); // up to the substitution
printf("%s", name); // the sub name
p = q+7; // continue with rest
}
- printf("%s\\n\"\n", p);
+ esc(p);
+ printf("\\n\"\n", p);
}
fprintf(stderr, "did not find end of imports\n");
exit(1);
@@ -75,3 +78,13 @@
printf("\t\"$$\\n\";\n");
return 0;
}
+
+void
+esc(char *p)
+{
+ for(; *p; p++) {
+ if(*p == '\\' || *p == '\"')
+ printf("\\");
+ putchar(*p);
+ }
+}
« no previous file with comments | « src/cmd/gc/go.y ('k') | src/cmd/gc/obj.c » ('j') | no next file with comments »

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