Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
6b5c9cc7
Commit
6b5c9cc7
authored
16 years ago
by
Roberto Raggi
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup
parent
c4877cf6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/cplusplus/PreprocessorEnvironment.cpp
+11
-5
11 additions, 5 deletions
src/libs/cplusplus/PreprocessorEnvironment.cpp
src/libs/cplusplus/PreprocessorEnvironment.h
+7
-12
7 additions, 12 deletions
src/libs/cplusplus/PreprocessorEnvironment.h
with
18 additions
and
17 deletions
src/libs/cplusplus/PreprocessorEnvironment.cpp
+
11
−
5
View file @
6b5c9cc7
...
...
@@ -97,7 +97,7 @@ Macro *Environment::bind(const Macro &__macro)
else
_allocated_macros
<<=
1
;
_macros
=
(
Macro
**
)
realloc
(
_macros
,
sizeof
(
Macro
*
)
*
_allocated_macros
);
_macros
=
reinterpret_cast
<
Macro
**
>
(
realloc
(
_macros
,
sizeof
(
Macro
*
)
*
_allocated_macros
)
)
;
}
_macros
[
_macro_count
]
=
m
;
...
...
@@ -147,7 +147,7 @@ void Environment::reset()
_hash_count
=
401
;
}
bool
Environment
::
isBuiltinMacro
(
const
QByteArray
&
s
)
const
bool
Environment
::
isBuiltinMacro
(
const
QByteArray
&
s
)
{
if
(
s
.
length
()
!=
8
)
return
false
;
...
...
@@ -211,6 +211,12 @@ bool Environment::isBuiltinMacro(const QByteArray &s) const
return
false
;
}
Environment
::
iterator
Environment
::
firstMacro
()
const
{
return
_macros
;
}
Environment
::
iterator
Environment
::
lastMacro
()
const
{
return
_macros
+
_macro_count
+
1
;
}
Macro
*
Environment
::
resolve
(
const
QByteArray
&
name
)
const
{
if
(
!
_macros
)
...
...
@@ -244,10 +250,10 @@ void Environment::rehash()
_hash_count
<<=
1
;
}
_hash
=
(
Macro
**
)
calloc
(
_hash_count
,
sizeof
(
Macro
*
));
_hash
=
reinterpret_cast
<
Macro
**
>
(
calloc
(
_hash_count
,
sizeof
(
Macro
*
))
)
;
for
(
Macro
**
it
=
firstMacro
();
it
!=
lastMacro
();
++
it
)
{
Macro
*
m
=
*
it
;
for
(
iterator
it
=
firstMacro
();
it
!=
lastMacro
();
++
it
)
{
Macro
*
m
=
*
it
;
const
unsigned
h
=
m
->
_hashcode
%
_hash_count
;
m
->
_next
=
_hash
[
h
];
_hash
[
h
]
=
m
;
...
...
This diff is collapsed.
Click to expand it.
src/libs/cplusplus/PreprocessorEnvironment.h
+
7
−
12
View file @
6b5c9cc7
...
...
@@ -61,6 +61,9 @@ class Macro;
class
CPLUSPLUS_EXPORT
Environment
{
public:
typedef
Macro
**
iterator
;
public:
Environment
();
~
Environment
();
...
...
@@ -72,23 +75,15 @@ public:
Macro
*
remove
(
const
QByteArray
&
name
);
Macro
*
resolve
(
const
QByteArray
&
name
)
const
;
bool
isBuiltinMacro
(
const
QByteArray
&
name
)
const
;
const
Macro
*
const
*
firstMacro
()
const
{
return
_macros
;
}
Macro
**
firstMacro
()
{
return
_macros
;
}
const
Macro
*
const
*
lastMacro
()
const
{
return
_macros
+
_macro_count
+
1
;
}
Macro
**
lastMacro
()
{
return
_macros
+
_macro_count
+
1
;
}
iterator
firstMacro
()
const
;
iterator
lastMacro
()
const
;
void
reset
();
void
addMacros
(
const
QList
<
Macro
>
&
macros
);
static
bool
isBuiltinMacro
(
const
QByteArray
&
name
);
private:
static
unsigned
hashCode
(
const
QByteArray
&
s
);
void
rehash
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment