Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
1600b7d6
Commit
1600b7d6
authored
Jun 04, 2004
by
Nicola Pero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved [Protocol -isEqual:], now more correct and faster
From-SVN: r82619
parent
c759d454
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletions
+33
-1
libobjc/ChangeLog
+10
-0
libobjc/Protocol.m
+23
-1
No files found.
libobjc/ChangeLog
View file @
1600b7d6
2004-06-03 Nicola Pero <n.pero@mi.flashnet.it>
* Protocol.m ([-isEqual:]): Small optimizations returning
immediately if the argument is equal to self, and accessing
the argument's name directly if it's a protocol.
2004-06-03 David Ayers <d.ayers@inode.at>
* Protocol.m ([-isEqual:]): Test the class of the argument.
2004-05-25 Andrew Pinski <pinskia@physics.uc.edu>
* configure.ac (includedir): Rename to ...
...
...
libobjc/Protocol.m
View file @
1600b7d6
...
...
@@ -150,11 +150,33 @@ struct objc_method_description_list {
return
hash
;
}
/*
* Equality between formal protocols is only formal (nothing to do
* with actually checking the list of methods they have!). Two formal
* Protocols are equal if and only if they have the same name.
*
* Please note (for comparisons with other implementations) that
* checking the names is equivalent to checking that Protocol A
* conforms to Protocol B and Protocol B conforms to Protocol A,
* because this happens iff they have the same name. If they have
* different names, A conforms to B if and only if A includes B, but
* the situation where A includes B and B includes A is a circular
* dependency between Protocols which is forbidden by the compiler, so
* A conforms to B and B conforms to A with A and B having different
* names is an impossible case.
*/
-
(
BOOL
)
isEqual
:
(
id
)
obj
{
if
(
strcmp
(
protocol_name
,
[
obj
name
])
==
0
)
if
(
obj
==
self
)
return
YES
;
if
([
obj
isKindOf
:
[
Protocol
class
]])
{
if
(
strcmp
(
protocol_name
,
((
Protocol
*
)
obj
)
->
protocol_name
)
==
0
)
return
YES
;
}
return
NO
;
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment