Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobdigest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
uplex-varnish
libvmod-blobdigest
Commits
a55b77ad
Commit
a55b77ad
authored
Nov 04, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use workspace for task data, rather than malloc/free
parent
4bedba51
Pipeline
#63
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
vmod_blobdigest.c
src/vmod_blobdigest.c
+17
-14
No files found.
src/vmod_blobdigest.c
View file @
a55b77ad
...
...
@@ -240,14 +240,6 @@ ws_alloc_digest(VRT_CTX, const size_t digestsz,
/* Objects */
static
void
free_digest_task
(
void
*
p
)
{
struct
digest_task
*
task
;
CAST_OBJ_NOTNULL
(
task
,
p
,
VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC
);
FREE_OBJ
(
task
);
}
static
struct
digest_task
*
get_task
(
const
struct
vrt_ctx
*
const
restrict
ctx
,
const
struct
vmod_blobdigest_digest
*
const
restrict
h
)
...
...
@@ -260,12 +252,15 @@ get_task(const struct vrt_ctx * const restrict ctx,
if
(
priv
->
priv
!=
NULL
)
CAST_OBJ
(
task
,
priv
->
priv
,
VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC
);
else
{
ALLOC_OBJ
(
task
,
VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC
);
AN
(
task
);
if
((
task
=
WS_Alloc
(
ctx
->
ws
,
sizeof
(
struct
digest_task
)))
==
NULL
)
return
NULL
;
task
->
magic
=
VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC
;
memcpy
(
&
task
->
ctx
,
&
h
->
ctx
,
sizeof
(
hash_ctx
));
AZ
(
task
->
result
)
;
task
->
result
=
NULL
;
priv
->
priv
=
task
;
priv
->
free
=
free_digest_task
;
priv
->
len
=
sizeof
(
struct
digest_task
);
priv
->
free
=
NULL
;
}
return
task
;
}
...
...
@@ -337,7 +332,11 @@ vmod_digest_update(VRT_CTX, struct vmod_blobdigest_digest *h, VCL_BLOB b)
}
task
=
get_task
(
ctx
,
h
);
CHECK_OBJ_NOTNULL
(
task
,
VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC
);
if
(
task
==
NULL
)
{
VERRNOMEM
(
ctx
,
"allocating task data in %s.update()"
,
h
->
vcl_name
);
return
0
;
}
if
(
task
->
result
!=
NULL
)
{
VERR
(
ctx
,
"already finalized in %s.update()"
,
h
->
vcl_name
);
return
0
;
...
...
@@ -377,7 +376,11 @@ vmod_digest_final(VRT_CTX, struct vmod_blobdigest_digest *h)
}
task
=
get_task
(
ctx
,
h
);
CHECK_OBJ_NOTNULL
(
task
,
VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC
);
if
(
task
==
NULL
)
{
VERRNOMEM
(
ctx
,
"allocating task data in %s.final()"
,
h
->
vcl_name
);
return
NULL
;
}
if
(
task
->
result
!=
NULL
)
return
task
->
result
;
...
...
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