Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Brad King
KWSys
Commits
19c31914
Commit
19c31914
authored
Jul 14, 2016
by
Dāvis Mosāns
Committed by
Brad King
Jul 14, 2016
Browse files
Options
Downloads
Patches
Plain Diff
SystemTools: Abstract environment storage character type
Change-Id: If7753c828c211998b76a1706ca7fd35fbb4c1f71
parent
2aa7dd82
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SystemTools.cxx
+11
-8
11 additions, 8 deletions
SystemTools.cxx
with
11 additions
and
8 deletions
SystemTools.cxx
+
11
−
8
View file @
19c31914
...
...
@@ -388,10 +388,13 @@ class SystemToolsTranslationMap :
{
};
/* Type of character storing the environment. */
typedef
char
envchar
;
/* Order by environment key only (VAR from VAR=VALUE). */
struct
kwsysEnvCompare
{
bool
operator
()
(
const
char
*
l
,
const
char
*
r
)
const
bool
operator
()
(
const
env
char
*
l
,
const
env
char
*
r
)
const
{
const
char
*
leq
=
strchr
(
l
,
'='
);
const
char
*
req
=
strchr
(
r
,
'='
);
...
...
@@ -408,20 +411,20 @@ struct kwsysEnvCompare
}
};
class
kwsysEnvSet
:
public
std
::
set
<
const
char
*
,
kwsysEnvCompare
>
class
kwsysEnvSet
:
public
std
::
set
<
const
env
char
*
,
kwsysEnvCompare
>
{
public:
class
Free
{
const
char
*
Env
;
const
env
char
*
Env
;
public:
Free
(
const
char
*
env
)
:
Env
(
env
)
{}
~
Free
()
{
free
(
const_cast
<
char
*>
(
this
->
Env
));
}
Free
(
const
env
char
*
env
)
:
Env
(
env
)
{}
~
Free
()
{
free
(
const_cast
<
env
char
*>
(
this
->
Env
));
}
};
const
char
*
Release
(
const
char
*
env
)
const
env
char
*
Release
(
const
env
char
*
env
)
{
const
char
*
old
=
0
;
const
env
char
*
old
=
0
;
iterator
i
=
this
->
find
(
env
);
if
(
i
!=
this
->
end
())
{
...
...
@@ -680,7 +683,7 @@ public:
for
(
iterator
i
=
this
->
begin
();
i
!=
this
->
end
();
++
i
)
{
kwsysUnPutEnv
(
*
i
);
free
(
const_cast
<
char
*>
(
*
i
));
free
(
const_cast
<
env
char
*>
(
*
i
));
}
}
bool
Put
(
const
char
*
env
)
...
...
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