summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-28 13:08:37 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-28 13:08:37 +0000
commit27969db4877003ef1de4091ebf197eb865b9c558 (patch)
tree9b5dfa811dd66d83194bea91dd5b2d2150826f29 /libobjc
parentd82e2f006b2921267ce00ddd84b609f20b3f70b9 (diff)
downloadgcc-27969db4877003ef1de4091ebf197eb865b9c558.tar.gz
Fixed critical typo in Objective-C runtime garbage collection code
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170561 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/ChangeLog6
-rw-r--r--libobjc/gc.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 3d85c982041..a9399e6bea9 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-28 Richard Frith-Macdonald <rfm@gnu.org>
+
+ PR libobjc/47922
+ * gc.c (class_ivar_set_gcinvisible): Use _C_GCINVISIBLE instead of
+ a hardcoded "!".
+
2011-02-13 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate.
diff --git a/libobjc/gc.c b/libobjc/gc.c
index d36a9cc77de..5ea4f8a0915 100644
--- a/libobjc/gc.c
+++ b/libobjc/gc.c
@@ -422,11 +422,15 @@ class_ivar_set_gcinvisible (Class class, const char *ivarname,
/* The variable is gc visible so we make it gc_invisible. */
new_type = objc_malloc (strlen(ivar->ivar_type) + 2);
+
+ /* Copy the variable name. */
len = (type - ivar->ivar_type);
memcpy (new_type, ivar->ivar_type, len);
- new_type[len] = 0;
- strcat (new_type, "!");
- strcat (new_type, type);
+ /* Add '!'. */
+ new_type[len++] = _C_GCINVISIBLE;
+ /* Copy the original types. */
+ strcpy (new_type + len, type);
+
ivar->ivar_type = new_type;
}