Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
5811033c
Commit
5811033c
authored
Jul 24, 2009
by
Ivan Donchevskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Writing fields in classes CycleStorage and TableBlockStorage using memcpy
parent
30d0f9a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
16 deletions
+8
-16
CycleStorage.cc
src/Various/CycleStorage.cc
+4
-8
TableBlockStorage.cc
src/Various/TableBlockStorage.cc
+4
-8
No files found.
src/Various/CycleStorage.cc
View file @
5811033c
...
...
@@ -209,8 +209,7 @@ bool CycleStorage::AddRow(char* str)
if
(
head
==-
1
)
{
jrn
->
status
=
1
;
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
((
char
*
)(
jrn
)
+
sizeof
(
CycleStorageElem
)
+
k
)
=*
(
str
+
k
);
memcpy
((
void
*
)((
char
*
)
jrn
+
sizeof
(
CycleStorageElem
)),(
void
*
)
str
,
inf_size
);
filewrite
(
jrn
,
0
);
head
=
0
;
tail
=
0
;
...
...
@@ -219,8 +218,7 @@ bool CycleStorage::AddRow(char* str)
if
(
head
==
tail
)
{
jrn
->
status
=
2
;
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
((
char
*
)(
jrn
)
+
sizeof
(
CycleStorageElem
)
+
k
)
=*
(
str
+
k
);
memcpy
((
void
*
)((
char
*
)
jrn
+
sizeof
(
CycleStorageElem
)),(
void
*
)
str
,
inf_size
);
filewrite
(
jrn
,
1
);
tail
=
1
;
return
true
;
...
...
@@ -242,8 +240,7 @@ bool CycleStorage::AddRow(char* str)
if
(
jrn
->
status
==
0
)
{
jrn
->
status
=
2
;
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
((
char
*
)(
jrn
)
+
sizeof
(
CycleStorageElem
)
+
k
)
=*
(
str
+
k
);
memcpy
((
void
*
)((
char
*
)
jrn
+
sizeof
(
CycleStorageElem
)),(
void
*
)
str
,
inf_size
);
filewrite
(
jrn
,
tail
);
return
true
;
}
...
...
@@ -252,8 +249,7 @@ bool CycleStorage::AddRow(char* str)
head
++
;
if
(
head
>=
size
)
head
=
0
;
jrn
->
status
=
i
;
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
((
char
*
)(
jrn
)
+
sizeof
(
CycleStorageElem
)
+
k
)
=*
(
str
+
k
);
memcpy
((
void
*
)((
char
*
)
jrn
+
sizeof
(
CycleStorageElem
)),(
void
*
)
str
,
inf_size
);
filewrite
(
jrn
,
tail
);
fseek
(
file
,
seekpos
+
head
*
(
sizeof
(
CycleStorageElem
)
+
inf_size
),
0
);
fread
(
jrn
,(
sizeof
(
CycleStorageElem
)
+
inf_size
),
1
,
file
);
...
...
src/Various/TableBlockStorage.cc
View file @
5811033c
...
...
@@ -246,16 +246,13 @@ bool TableBlockStorage::AddRow(char* key, char* value)
if
(
pos
>=
0
)
{
mem
[
pos
]
->
count
=++
max
;
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
((
char
*
)
mem
[
pos
]
+
sizeof
(
TableBlockStorageElem
)
+
k_size
+
k
)
=*
(
value
+
k
);
memcpy
((
void
*
)((
char
*
)
mem
[
pos
]
+
sizeof
(
TableBlockStorageElem
)
+
k_size
),(
void
*
)
value
,
inf_size
);
filewrite
(
mem
[
pos
],
cur_block
*
block_size
+
pos
);
return
true
;;
}
mem
[
empty
]
->
count
=++
max
;
for
(
k
=
0
;
k
<
k_size
;
k
++
)
*
((
char
*
)
mem
[
empty
]
+
sizeof
(
TableBlockStorageElem
)
+
k
)
=*
(
key
+
k
);
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
((
char
*
)
mem
[
empty
]
+
sizeof
(
TableBlockStorageElem
)
+
k_size
+
k
)
=*
(
value
+
k
);
memcpy
((
void
*
)((
char
*
)
mem
[
empty
]
+
sizeof
(
TableBlockStorageElem
)),(
void
*
)
key
,
k_size
);
memcpy
((
void
*
)((
char
*
)
mem
[
empty
]
+
sizeof
(
TableBlockStorageElem
)
+
k_size
),(
void
*
)
value
,
inf_size
);
filewrite
(
mem
[
empty
],
cur_block
*
block_size
+
empty
);
return
true
;
}
...
...
@@ -290,8 +287,7 @@ char* TableBlockStorage::FindKeyValue(char* key, char* val)
if
((
*
((
char
*
)
mem
[
i
]
+
sizeof
(
TableBlockStorageElem
))
!=
0
)
&&
(
mem
[
i
]
>=
0
))
if
(
KeyCompare
((
char
*
)
mem
[
i
],
key
,
k_size
))
{
for
(
k
=
0
;
k
<
inf_size
;
k
++
)
*
(
val
+
k
)
=*
((
char
*
)
mem
[
i
]
+
sizeof
(
TableBlockStorageElem
)
+
k_size
+
k
);
memcpy
((
void
*
)
val
,(
void
*
)((
char
*
)
mem
[
i
]
+
sizeof
(
TableBlockStorageElem
)
+
k_size
),
inf_size
);
return
val
;
}
}
...
...
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