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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c29cd379
Commit
c29cd379
authored
Jul 05, 2004
by
mysqldev@melody.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#4384
parent
fb7f1518
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 @
c29cd379
...
@@ -123,6 +123,7 @@ mwagner@work.mysql.com
...
@@ -123,6 +123,7 @@ mwagner@work.mysql.com
mydev@mysql.com
mydev@mysql.com
mysql@home.(none)
mysql@home.(none)
mysqldev@build.mysql2.com
mysqldev@build.mysql2.com
mysqldev@melody.local
mysqldev@mysql.com
mysqldev@mysql.com
ndbdev@ndbmaster.mysql.com
ndbdev@ndbmaster.mysql.com
nick@mysql.com
nick@mysql.com
...
...
ndb/include/util/ConfigValues.hpp
View file @
c29cd379
...
@@ -24,8 +24,8 @@ public:
...
@@ -24,8 +24,8 @@ public:
ValueType
m_type
;
ValueType
m_type
;
union
{
union
{
Uint32
m_int
;
Uint32
m_int
;
const
char
*
m_string
;
Uint64
m_int64
;
Uint64
m_int64
;
const
char
*
m_string
;
};
};
};
};
...
@@ -72,14 +72,14 @@ private:
...
@@ -72,14 +72,14 @@ private:
friend
class
ConstIterator
;
friend
class
ConstIterator
;
bool
getByPos
(
Uint32
pos
,
Entry
*
)
const
;
bool
getByPos
(
Uint32
pos
,
Entry
*
)
const
;
Uint64
&
get64
(
Uint32
index
)
const
;
Uint64
*
get64
(
Uint32
index
)
const
;
char
*
&
getString
(
Uint32
index
)
const
;
char
*
*
getString
(
Uint32
index
)
const
;
Uint32
m_size
;
Uint32
m_size
;
Uint32
m_dataSize
;
Uint32
m_dataSize
;
Uint32
m_stringCount
;
Uint32
m_stringCount
;
Uint32
m_int64Count
;
Uint32
m_int64Count
;
Uint32
m_values
[
1
];
Uint32
m_values
[
1
];
void
*
m_data
[
1
];
void
*
m_data
[
1
];
};
};
...
...
ndb/src/common/util/ConfigValues.cpp
View file @
c29cd379
...
@@ -60,7 +60,7 @@ ConfigValues::ConfigValues(Uint32 sz, Uint32 dsz){
...
@@ -60,7 +60,7 @@ ConfigValues::ConfigValues(Uint32 sz, Uint32 dsz){
ConfigValues
::~
ConfigValues
(){
ConfigValues
::~
ConfigValues
(){
for
(
Uint32
i
=
0
;
i
<
m_stringCount
;
i
++
){
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 {
...
@@ -87,10 +87,10 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
result
->
m_int
=
val
;
result
->
m_int
=
val
;
break
;
break
;
case
StringType
:
case
StringType
:
result
->
m_string
=
getString
(
val
);
result
->
m_string
=
*
getString
(
val
);
break
;
break
;
case
Int64Type
:
case
Int64Type
:
result
->
m_int64
=
get64
(
val
);
result
->
m_int64
=
*
get64
(
val
);
break
;
break
;
case
InvalidType
:
case
InvalidType
:
default:
default:
...
@@ -102,18 +102,23 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
...
@@ -102,18 +102,23 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
return
true
;
return
true
;
}
}
Uint64
&
Uint64
*
ConfigValues
::
get64
(
Uint32
index
)
const
{
ConfigValues
::
get64
(
Uint32
index
)
const
{
assert
(
index
<
m_int64Count
);
assert
(
index
<
m_int64Count
);
Uint64
*
ptr
=
(
Uint64
*
)(
&
m_values
[
m_size
<<
1
]);
const
Uint32
*
data
=
m_values
+
(
m_size
<<
1
);
return
ptr
[
index
];
Uint64
*
ptr
=
(
Uint64
*
)
data
;
ptr
+=
index
;
return
ptr
;
}
}
char
*
&
char
*
*
ConfigValues
::
getString
(
Uint32
index
)
const
{
ConfigValues
::
getString
(
Uint32
index
)
const
{
assert
(
index
<
m_stringCount
);
assert
(
index
<
m_stringCount
);
char
**
ptr
=
(
char
**
)(((
char
*
)
&
(
m_values
[
m_size
<<
1
]))
+
m_dataSize
);
const
Uint32
*
data
=
m_values
+
(
m_size
<<
1
);
return
ptr
[
-
index
];
char
*
ptr
=
(
char
*
)
data
;
ptr
+=
m_dataSize
;
ptr
-=
(
index
*
sizeof
(
char
*
));
return
(
char
**
)
ptr
;
}
}
bool
bool
...
@@ -176,7 +181,7 @@ ConfigValues::Iterator::set(Uint32 key, Uint64 value){
...
@@ -176,7 +181,7 @@ ConfigValues::Iterator::set(Uint32 key, Uint64 value){
return
false
;
return
false
;
}
}
m_cfg
.
get64
(
m_cfg
.
m_values
[
pos
+
1
])
=
value
;
*
m_cfg
.
get64
(
m_cfg
.
m_values
[
pos
+
1
])
=
value
;
return
true
;
return
true
;
}
}
...
@@ -191,9 +196,9 @@ ConfigValues::Iterator::set(Uint32 key, const char * value){
...
@@ -191,9 +196,9 @@ ConfigValues::Iterator::set(Uint32 key, const char * value){
return
false
;
return
false
;
}
}
char
*
&
str
=
m_cfg
.
getString
(
m_cfg
.
m_values
[
pos
+
1
]);
char
*
*
str
=
m_cfg
.
getString
(
m_cfg
.
m_values
[
pos
+
1
]);
free
(
str
);
free
(
*
str
);
str
=
strdup
(
value
?
value
:
""
);
*
str
=
strdup
(
value
?
value
:
""
);
return
true
;
return
true
;
}
}
...
@@ -457,7 +462,8 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
...
@@ -457,7 +462,8 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case
ConfigValues
:
:
StringType
:
{
case
ConfigValues
:
:
StringType
:
{
Uint32
index
=
m_cfg
->
m_stringCount
++
;
Uint32
index
=
m_cfg
->
m_stringCount
++
;
m_cfg
->
m_values
[
pos
+
1
]
=
index
;
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_freeKeys
--
;
m_freeData
-=
sizeof
(
char
*
);
m_freeData
-=
sizeof
(
char
*
);
DEBUG
printf
(
"Putting at: %d(%d) (loop = %d) key: %d value(%d): %s
\n
"
,
DEBUG
printf
(
"Putting at: %d(%d) (loop = %d) key: %d value(%d): %s
\n
"
,
...
@@ -470,7 +476,7 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
...
@@ -470,7 +476,7 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case
ConfigValues
:
:
Int64Type
:
{
case
ConfigValues
:
:
Int64Type
:
{
Uint32
index
=
m_cfg
->
m_int64Count
++
;
Uint32
index
=
m_cfg
->
m_int64Count
++
;
m_cfg
->
m_values
[
pos
+
1
]
=
index
;
m_cfg
->
m_values
[
pos
+
1
]
=
index
;
m_cfg
->
get64
(
index
)
=
entry
.
m_int64
;
*
m_cfg
->
get64
(
index
)
=
entry
.
m_int64
;
m_freeKeys
--
;
m_freeKeys
--
;
m_freeData
-=
8
;
m_freeData
-=
8
;
DEBUG
printf
(
"Putting at: %d(%d) (loop = %d) key: %d value64(%d): %lld
\n
"
,
DEBUG
printf
(
"Putting at: %d(%d) (loop = %d) key: %d value64(%d): %lld
\n
"
,
...
@@ -558,7 +564,7 @@ ConfigValues::getPackedSize() const {
...
@@ -558,7 +564,7 @@ ConfigValues::getPackedSize() const {
break
;
break
;
case
StringType
:
case
StringType
:
size
+=
8
;
// key + len
size
+=
8
;
// key + len
size
+=
mod4
(
strlen
(
getString
(
m_values
[
i
+
1
]))
+
1
);
size
+=
mod4
(
strlen
(
*
getString
(
m_values
[
i
+
1
]))
+
1
);
break
;
break
;
case
InvalidType
:
case
InvalidType
:
default:
default:
...
@@ -587,7 +593,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
...
@@ -587,7 +593,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
*
(
Uint32
*
)
dst
=
htonl
(
val
);
dst
+=
4
;
*
(
Uint32
*
)
dst
=
htonl
(
val
);
dst
+=
4
;
break
;
break
;
case
Int64Type
:{
case
Int64Type
:{
Uint64
i64
=
get64
(
val
);
Uint64
i64
=
*
get64
(
val
);
Uint32
hi
=
(
i64
>>
32
);
Uint32
hi
=
(
i64
>>
32
);
Uint32
lo
=
(
i64
&
0xFFFFFFFF
);
Uint32
lo
=
(
i64
&
0xFFFFFFFF
);
*
(
Uint32
*
)
dst
=
htonl
(
key
);
dst
+=
4
;
*
(
Uint32
*
)
dst
=
htonl
(
key
);
dst
+=
4
;
...
@@ -596,7 +602,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
...
@@ -596,7 +602,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
}
}
break
;
break
;
case
StringType
:{
case
StringType
:{
const
char
*
str
=
getString
(
val
);
const
char
*
str
=
*
getString
(
val
);
Uint32
len
=
strlen
(
str
)
+
1
;
Uint32
len
=
strlen
(
str
)
+
1
;
*
(
Uint32
*
)
dst
=
htonl
(
key
);
dst
+=
4
;
*
(
Uint32
*
)
dst
=
htonl
(
key
);
dst
+=
4
;
*
(
Uint32
*
)
dst
=
htonl
(
len
);
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