Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
core
tarantool
Commits
0ae52281
Commit
0ae52281
authored
12 years ago
by
Dmitry Simonenko
Browse files
Options
Downloads
Patches
Plain Diff
connect-c-lite: opsplice implementation.
parent
aa2e0fb6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
connector/c/include/tp.h
+26
-2
26 additions, 2 deletions
connector/c/include/tp.h
with
26 additions
and
2 deletions
connector/c/include/tp.h
+
26
−
2
View file @
0ae52281
...
...
@@ -62,7 +62,7 @@ typedef char *(*tp_resizer)(struct tp *p, size_t req, size_t *size);
#define TP_FREP 4
#define TP_FQUIET 8
#define TP_OP
EQ
0
#define TP_OP
SET
0
#define TP_OPADD 1
#define TP_OPAND 2
#define TP_OPXOR 3
...
...
@@ -384,7 +384,8 @@ tp_op(struct tp *p, uint32_t field, uint8_t op, char *data,
p
->
p
+=
sizeof
(
uint8_t
);
/* data */
tp_leb128save
(
p
,
size
);
memcpy
(
p
->
p
,
data
,
size
);
if
(
tp_likely
(
data
))
memcpy
(
p
->
p
,
data
,
size
);
p
->
p
+=
size
;
/* update offset and count */
p
->
h
->
len
+=
sz
;
...
...
@@ -392,6 +393,29 @@ tp_op(struct tp *p, uint32_t field, uint8_t op, char *data,
return
tp_used
(
p
);
}
static
inline
ssize_t
tp_opsplice
(
struct
tp
*
p
,
uint32_t
field
,
uint32_t
off
,
uint32_t
len
,
char
*
data
,
size_t
size
)
{
uint32_t
olen
=
tp_leb128sizeof
(
sizeof
(
off
)),
llen
=
tp_leb128sizeof
(
sizeof
(
len
)),
dlen
=
tp_leb128sizeof
(
size
);
uint32_t
sz
=
olen
+
sizeof
(
off
)
+
llen
+
sizeof
(
len
)
+
dlen
+
size
;
ssize_t
rc
=
tp_op
(
p
,
field
,
TP_OPSPLICE
,
NULL
,
sz
);
if
(
tp_unlikely
(
rc
==
-
1
))
return
-
1
;
tp_leb128save
(
p
,
sizeof
(
off
));
memcpy
(
p
->
p
,
&
off
,
sizeof
(
off
));
p
->
p
+=
sizeof
(
off
);
tp_leb128save
(
p
,
sizeof
(
len
));
memcpy
(
p
->
p
,
&
len
,
sizeof
(
len
));
p
->
p
+=
sizeof
(
len
);
tp_leb128save
(
p
,
size
);
memcpy
(
p
->
p
,
data
,
size
);
p
+=
size
;
return
rc
;
}
static
inline
ssize_t
tp_sz
(
struct
tp
*
p
,
char
*
sz
)
{
return
tp_field
(
p
,
sz
,
strlen
(
sz
));
...
...
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