diff options
author | Andrew Pinski <apinski@apple.com> | 2003-10-06 01:36:13 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2003-10-05 18:36:13 -0700 |
commit | 6e08ecd16c43f224aa7ed4f8fa213ad0e530da0f (patch) | |
tree | 9e2176053081210ecdffe34649cbcac01d0dedbd | |
parent | 522d2b3fccdaea685db88d1533789e42f61511a6 (diff) | |
download | gcc-6e08ecd16c43f224aa7ed4f8fa213ad0e530da0f.zip gcc-6e08ecd16c43f224aa7ed4f8fa213ad0e530da0f.tar.gz gcc-6e08ecd16c43f224aa7ed4f8fa213ad0e530da0f.tar.bz2 |
darwin.c (machopic_non_lazy_ptr_name): Change strcat to memcpy and add length together.
* config/darwin.c (machopic_non_lazy_ptr_name):
Change strcat to memcpy and add length together.
(machopic_stub_name): Likewise.
From-SVN: r72129
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/darwin.c | 51 |
2 files changed, 44 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac396db..ea5a570 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-10-05 Andrew Pinski <apinski@apple.com> + + * config/darwin.c (machopic_non_lazy_ptr_name): + Change strcat to memcpy and add length together. + (machopic_stub_name): Likewise. + 2003-10-05 Kaz Kojima <kkojima@gcc.gnu.org> * config/sh/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Handle new diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index f701dce..85c00ba 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -294,20 +294,28 @@ machopic_non_lazy_ptr_name (const char *name) { char *buffer; + int namelen = strlen (name); + int bufferlen = 0; tree ptr_name; - buffer = alloca (strlen (name) + 20); + buffer = alloca (namelen + strlen("$non_lazy_ptr") + 5); strcpy (buffer, "&L"); + bufferlen = 2; if (name[0] == '*') - strcat (buffer, name+1); + { + memcpy (buffer+bufferlen, name+1, namelen-1+1); + bufferlen += namelen-1; + } else { - strcat (buffer, "_"); - strcat (buffer, name); + buffer[bufferlen] = '_'; + memcpy (buffer+bufferlen+1, name, namelen+1); + bufferlen += namelen; } - strcat (buffer, "$non_lazy_ptr"); + memcpy (buffer + bufferlen, "$non_lazy_ptr", strlen("$non_lazy_ptr")+1); + bufferlen += strlen("$non_lazy_ptr"); ptr_name = get_identifier (buffer); machopic_non_lazy_pointers @@ -351,29 +359,46 @@ machopic_stub_name (const char *name) { char *buffer; + int bufferlen = 0; + int namelen = strlen (name); tree ptr_name; int needs_quotes = name_needs_quotes (name); - buffer = alloca (strlen (name) + 20); + buffer = alloca (namelen + 20); if (needs_quotes) - strcpy (buffer, "&\"L"); + { + strcpy (buffer, "&\"L"); + bufferlen = strlen("&\"L"); + } else - strcpy (buffer, "&L"); + { + strcpy (buffer, "&L"); + bufferlen = strlen("&L"); + } + if (name[0] == '*') { - strcat (buffer, name+1); + memcpy (buffer + bufferlen, name+1, namelen - 1 +1); + bufferlen += namelen - 1; } else { - strcat (buffer, "_"); - strcat (buffer, name); + buffer[bufferlen] = '_'; + memcpy (buffer + bufferlen +1, name, namelen+1); + bufferlen += namelen; } if (needs_quotes) - strcat (buffer, "$stub\""); + { + memcpy (buffer + bufferlen, "$stub\"", strlen("$stub\"")); + bufferlen += strlen("$stub\""); + } else - strcat (buffer, "$stub"); + { + memcpy (buffer + bufferlen, "$stub", strlen("$stub")); + bufferlen += strlen("$stub"); + } ptr_name = get_identifier (buffer); machopic_stubs = tree_cons (ptr_name, ident, machopic_stubs); |