Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
57b173cb
Commit
57b173cb
authored
Jul 05, 2004
by
mysqldev@melody.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal:/home/bk/mysql-4.1
into melody.local:/home/mysqldev/jonas/mysql-4.1
parents
b5c6ced1
c29cd379
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
23 deletions
+30
-23
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
ndb/include/util/ConfigValues.hpp
ndb/include/util/ConfigValues.hpp
+4
-4
ndb/src/common/util/ConfigValues.cpp
ndb/src/common/util/ConfigValues.cpp
+25
-19
No files found.
BitKeeper/etc/logging_ok
View file @
57b173cb
...
...
@@ -123,6 +123,7 @@ mwagner@work.mysql.com
mydev@mysql.com
mysql@home.(none)
mysqldev@build.mysql2.com
mysqldev@melody.local
mysqldev@mysql.com
ndbdev@ndbmaster.mysql.com
nick@mysql.com
...
...
ndb/include/util/ConfigValues.hpp
View file @
57b173cb
...
...
@@ -24,8 +24,8 @@ public:
ValueType
m_type
;
union
{
Uint32
m_int
;
const
char
*
m_string
;
Uint64
m_int64
;
const
char
*
m_string
;
};
};
...
...
@@ -72,14 +72,14 @@ private:
friend
class
ConstIterator
;
bool
getByPos
(
Uint32
pos
,
Entry
*
)
const
;
Uint64
&
get64
(
Uint32
index
)
const
;
char
*
&
getString
(
Uint32
index
)
const
;
Uint64
*
get64
(
Uint32
index
)
const
;
char
*
*
getString
(
Uint32
index
)
const
;
Uint32
m_size
;
Uint32
m_dataSize
;
Uint32
m_stringCount
;
Uint32
m_int64Count
;
Uint32
m_values
[
1
];
void
*
m_data
[
1
];
};
...
...
ndb/src/common/util/ConfigValues.cpp
View file @
57b173cb
...
...
@@ -60,7 +60,7 @@ ConfigValues::ConfigValues(Uint32 sz, Uint32 dsz){
ConfigValues
::~
ConfigValues
(){
for
(
Uint32
i
=
0
;
i
<
m_stringCount
;
i
++
){
free
(
getString
(
i
));
free
(
*
getString
(
i
));
}
}
...
...
@@ -87,10 +87,10 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
result
->
m_int
=
val
;
break
;
case
StringType
:
result
->
m_string
=
getString
(
val
);
result
->
m_string
=
*
getString
(
val
);
break
;
case
Int64Type
:
result
->
m_int64
=
get64
(
val
);
result
->
m_int64
=
*
get64
(
val
);
break
;
case
InvalidType
:
default:
...
...
@@ -102,18 +102,23 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
return
true
;
}
Uint64
&
Uint64
*
ConfigValues
::
get64
(
Uint32
index
)
const
{
assert
(
index
<
m_int64Count
);
Uint64
*
ptr
=
(
Uint64
*
)(
&
m_values
[
m_size
<<
1
]);
return
ptr
[
index
];
const
Uint32
*
data
=
m_values
+
(
m_size
<<
1
);
Uint64
*
ptr
=
(
Uint64
*
)
data
;
ptr
+=
index
;
return
ptr
;
}
char
*
&
char
*
*
ConfigValues
::
getString
(
Uint32
index
)
const
{
assert
(
index
<
m_stringCount
);
char
**
ptr
=
(
char
**
)(((
char
*
)
&
(
m_values
[
m_size
<<
1
]))
+
m_dataSize
);
return
ptr
[
-
index
];
assert
(
index
<
m_stringCount
);
const
Uint32
*
data
=
m_values
+
(
m_size
<<
1
);
char
*
ptr
=
(
char
*
)
data
;
ptr
+=
m_dataSize
;
ptr
-=
(
index
*
sizeof
(
char
*
));
return
(
char
**
)
ptr
;
}
bool
...
...
@@ -176,7 +181,7 @@ ConfigValues::Iterator::set(Uint32 key, Uint64 value){
return
false
;
}
m_cfg
.
get64
(
m_cfg
.
m_values
[
pos
+
1
])
=
value
;
*
m_cfg
.
get64
(
m_cfg
.
m_values
[
pos
+
1
])
=
value
;
return
true
;
}
...
...
@@ -191,9 +196,9 @@ ConfigValues::Iterator::set(Uint32 key, const char * value){
return
false
;
}
char
*
&
str
=
m_cfg
.
getString
(
m_cfg
.
m_values
[
pos
+
1
]);
free
(
str
);
str
=
strdup
(
value
?
value
:
""
);
char
*
*
str
=
m_cfg
.
getString
(
m_cfg
.
m_values
[
pos
+
1
]);
free
(
*
str
);
*
str
=
strdup
(
value
?
value
:
""
);
return
true
;
}
...
...
@@ -457,7 +462,8 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case
ConfigValues
:
:
StringType
:
{
Uint32
index
=
m_cfg
->
m_stringCount
++
;
m_cfg
->
m_values
[
pos
+
1
]
=
index
;
m_cfg
->
getString
(
index
)
=
strdup
(
entry
.
m_string
?
entry
.
m_string
:
""
);
char
**
ref
=
m_cfg
->
getString
(
index
);
*
ref
=
strdup
(
entry
.
m_string
?
entry
.
m_string
:
""
);
m_freeKeys
--
;
m_freeData
-=
sizeof
(
char
*
);
DEBUG
printf
(
"Putting at: %d(%d) (loop = %d) key: %d value(%d): %s
\n
"
,
...
...
@@ -470,7 +476,7 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case
ConfigValues
:
:
Int64Type
:
{
Uint32
index
=
m_cfg
->
m_int64Count
++
;
m_cfg
->
m_values
[
pos
+
1
]
=
index
;
m_cfg
->
get64
(
index
)
=
entry
.
m_int64
;
*
m_cfg
->
get64
(
index
)
=
entry
.
m_int64
;
m_freeKeys
--
;
m_freeData
-=
8
;
DEBUG
printf
(
"Putting at: %d(%d) (loop = %d) key: %d value64(%d): %lld
\n
"
,
...
...
@@ -558,7 +564,7 @@ ConfigValues::getPackedSize() const {
break
;
case
StringType
:
size
+=
8
;
// key + len
size
+=
mod4
(
strlen
(
getString
(
m_values
[
i
+
1
]))
+
1
);
size
+=
mod4
(
strlen
(
*
getString
(
m_values
[
i
+
1
]))
+
1
);
break
;
case
InvalidType
:
default:
...
...
@@ -587,7 +593,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
*
(
Uint32
*
)
dst
=
htonl
(
val
);
dst
+=
4
;
break
;
case
Int64Type
:{
Uint64
i64
=
get64
(
val
);
Uint64
i64
=
*
get64
(
val
);
Uint32
hi
=
(
i64
>>
32
);
Uint32
lo
=
(
i64
&
0xFFFFFFFF
);
*
(
Uint32
*
)
dst
=
htonl
(
key
);
dst
+=
4
;
...
...
@@ -596,7 +602,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
}
break
;
case
StringType
:{
const
char
*
str
=
getString
(
val
);
const
char
*
str
=
*
getString
(
val
);
Uint32
len
=
strlen
(
str
)
+
1
;
*
(
Uint32
*
)
dst
=
htonl
(
key
);
dst
+=
4
;
*
(
Uint32
*
)
dst
=
htonl
(
len
);
dst
+=
4
;
...
...
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