summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2007-09-12 01:27:31 +0200
committerMatthias Benkard <code@mail.matthias.benkard.de>2007-09-12 01:27:31 +0200
commit48c9d92ba6d99a360c20440e800b89c5bd3b7033 (patch)
tree79a6e2e072eb1d766c669ea839db23e594c3dbcd /Objective-C
parentf9408631aa030926fad625ecf4d18f08b478fc1d (diff)
Use @encode to encode type information.
darcs-hash:cac9540730277baec26b4b6c8fa563ff649fc70b
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/libobjcl.m14
1 files changed, 7 insertions, 7 deletions
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index cd79eb6..f2e5d96 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -177,8 +177,8 @@ objcl_invoke_method (OBJCL_OBJ_DATA receiver,
NS_DURING
{
- assert (receiver->type[0] == '#'
- || receiver->type[0] == '@'
+ assert (strcmp (receiver->type, @encode (Class)) == 0
+ || strcmp (receiver->type, @encode (id)) == 0
|| receiver->type[0] == 'E');
switch (receiver->type[0])
{
@@ -218,7 +218,7 @@ objcl_find_class (const char *class_name)
Class class =
NSClassFromString ([NSString stringWithUTF8String: class_name]);
OBJCL_OBJ_DATA result = malloc (sizeof (struct objcl_object));
- const char *const typespec = "#8@0:4";
+ const char *const typespec = @encode (Class);
result->type = malloc (strlen (typespec) + 1);
strcpy (result->type, typespec);
@@ -234,7 +234,7 @@ objcl_find_selector (const char *class_name)
SEL selector =
NSSelectorFromString ([NSString stringWithUTF8String: class_name]);
OBJCL_OBJ_DATA result = malloc (sizeof (struct objcl_object));
- const char *const typespec = ":";
+ const char *const typespec = @encode (SEL);
result->type = malloc (strlen (typespec) + 1);
strcpy (result->type, typespec);
@@ -251,8 +251,8 @@ objcl_class_name (OBJCL_OBJ_DATA class)
char *name;
Class cls = NULL;
- assert (class->type[0] == '#'
- || class->type[0] == '@'
+ assert (strcmp (class->type, @encode (Class)) == 0
+ || strcmp (class->type, @encode (id)) == 0
|| class->type[0] == 'E');
switch (class->type[0])
{
@@ -275,7 +275,7 @@ objcl_selector_name (OBJCL_OBJ_DATA selector)
const char *ns_name;
char *name;
- assert (selector->type[0] == ':');
+ assert (strcmp (selector->type, @encode (SEL)) == 0);
ns_name = [(NSStringFromSelector (selector->data.sel_val))
UTF8String];
name = malloc (strlen (ns_name) + 1);