Mercurial > projects > ddmd
comparison dmd/Lexer.d @ 2:7427ded8caf7
Removed unreferenced modules
First step at fixing GC issues - now calling GC.malloc instead of malloc (ditto calloc and realloc), get rid of free
author | korDen |
---|---|
date | Sun, 25 Oct 2009 03:20:59 +0300 |
parents | 10317f0c89a5 |
children | d706d958e4e8 |
comparison
equal
deleted
inserted
replaced
1:5a2059196104 | 2:7427ded8caf7 |
---|---|
14 import dmd.Id; | 14 import dmd.Id; |
15 import dmd.Dchar; | 15 import dmd.Dchar; |
16 import dmd.Utf; | 16 import dmd.Utf; |
17 | 17 |
18 import std.stdio : writeln; | 18 import std.stdio : writeln; |
19 | |
20 import dmd.Memory; | |
19 | 21 |
20 import core.stdc.ctype; | 22 import core.stdc.ctype; |
21 import core.stdc.stdlib; | 23 import core.stdc.stdlib; |
22 import core.stdc.string; | 24 import core.stdc.string; |
23 import core.stdc.stdio; | 25 import core.stdc.stdio; |
711 break; | 713 break; |
712 } | 714 } |
713 } while (*p == '\\'); | 715 } while (*p == '\\'); |
714 t.len = stringbuffer.offset; | 716 t.len = stringbuffer.offset; |
715 stringbuffer.writeByte(0); | 717 stringbuffer.writeByte(0); |
716 char* cc = cast(char*)malloc(stringbuffer.offset); | 718 char* cc = cast(char*)GC.malloc(stringbuffer.offset); |
717 memcpy(cc, stringbuffer.data, stringbuffer.offset); | 719 memcpy(cc, stringbuffer.data, stringbuffer.offset); |
718 t.ustring = cc; | 720 t.ustring = cc; |
719 t.postfix = 0; | 721 t.postfix = 0; |
720 t.value = TOK.TOKstring; | 722 t.value = TOK.TOKstring; |
721 if (!global.params.useDeprecated) | 723 if (!global.params.useDeprecated) |
1620 break; | 1622 break; |
1621 | 1623 |
1622 case '"': | 1624 case '"': |
1623 t.len = stringbuffer.offset; | 1625 t.len = stringbuffer.offset; |
1624 stringbuffer.writeByte(0); | 1626 stringbuffer.writeByte(0); |
1625 char* tmp = cast(char*)malloc(stringbuffer.offset); | 1627 char* tmp = cast(char*)GC.malloc(stringbuffer.offset); |
1626 memcpy(tmp, stringbuffer.data, stringbuffer.offset); | 1628 memcpy(tmp, stringbuffer.data, stringbuffer.offset); |
1627 t.ustring = tmp; | 1629 t.ustring = tmp; |
1628 stringPostfix(t); | 1630 stringPostfix(t); |
1629 return TOK.TOKstring; | 1631 return TOK.TOKstring; |
1630 | 1632 |
2406 if (c2) | 2408 if (c2) |
2407 { | 2409 { |
2408 size_t len1 = strlen(cast(char*)c1); | 2410 size_t len1 = strlen(cast(char*)c1); |
2409 size_t len2 = strlen(cast(char*)c2); | 2411 size_t len2 = strlen(cast(char*)c2); |
2410 | 2412 |
2411 c = cast(ubyte*)malloc(len1 + 1 + len2 + 1); | 2413 c = cast(ubyte*)GC.malloc(len1 + 1 + len2 + 1); |
2412 memcpy(c, c1, len1); | 2414 memcpy(c, c1, len1); |
2413 if (len1 && c1[len1 - 1] != '\n') | 2415 if (len1 && c1[len1 - 1] != '\n') |
2414 { | 2416 { |
2415 c[len1] = '\n'; | 2417 c[len1] = '\n'; |
2416 len1++; | 2418 len1++; |