History

TOK_builtin_malloc: alternative solution

grischka committed 17 years ago

Commit 9a8b2911 parent 742cf052 files · +8 −14Browse files

Unified · Split

2 files
  1. tcc.c +4 −14
  2. tcctok.h +4 −0
tcc.c+4−14
@@ -7801,21 +7801,11 @@ static void unary(void) · 7800 unmodified lines
78017801 break;
78027802 #ifdef TCC_TARGET_X86_64
78037803 case TOK_builtin_malloc:
7804− {
7805− char *p = file->buf_ptr;
7806− file->buf_ptr = "malloc";
7807− next_nomacro1();
7808− file->buf_ptr = p;
7809− goto tok_identifier;
7810− }
7804+ tok = TOK_malloc;
7805+ goto tok_identifier;
78117806 case TOK_builtin_free:
7812− {
7813− char *p = file->buf_ptr;
7814− file->buf_ptr = "free";
7815− next_nomacro1();
7816− file->buf_ptr = p;
7817− goto tok_identifier;
7818− }
7807+ tok = TOK_free;
7808+ goto tok_identifier;
78197809 #endif
78207810 case TOK_INC:
78217811 case TOK_DEC:
tcctok.h+4−0
@@ -113,6 +113,8 @@ · 112 unmodified lines
113113 #ifdef TCC_TARGET_X86_64
114114 DEF(TOK_builtin_malloc, "__builtin_malloc")
115115 DEF(TOK_builtin_free, "__builtin_free")
116+ DEF(TOK_malloc, "malloc")
117+ DEF(TOK_free, "free")
116118 #endif
117119 DEF(TOK_REGPARM1, "regparm")
118120 DEF(TOK_REGPARM2, "__regparm__")
@@ -216,11 +218,13 @@ · 97 unmodified lines
216218 DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16")
217219 DEF(TOK___bound_local_new, "__bound_local_new")
218220 DEF(TOK___bound_local_delete, "__bound_local_delete")
221+#if 0
219222 DEF(TOK_malloc, "malloc")
220223 DEF(TOK_free, "free")
221224 DEF(TOK_realloc, "realloc")
222225 DEF(TOK_memalign, "memalign")
223226 DEF(TOK_calloc, "calloc")
227+#endif
224228 DEF(TOK_memmove, "memmove")
225229 DEF(TOK_strlen, "strlen")
226230 DEF(TOK_strcpy, "strcpy")

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t