Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
ef146407
Commit
ef146407
authored
Dec 09, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ObjIterate() wrapper function
parent
f5b92e27
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
cache.h
bin/varnishd/cache/cache.h
+3
-0
cache_obj.c
bin/varnishd/cache/cache_obj.c
+34
-0
No files found.
bin/varnishd/cache/cache.h
View file @
ef146407
...
...
@@ -855,6 +855,9 @@ void *MPL_Get(struct mempool *mpl, unsigned *size);
void
MPL_Free
(
struct
mempool
*
mpl
,
void
*
item
);
/* cache_obj.c */
typedef
int
objiterate_f
(
void
*
priv
,
int
flush
,
const
void
*
ptr
,
ssize_t
len
);
int
ObjIterate
(
struct
worker
*
,
struct
objcore
*
,
void
*
priv
,
objiterate_f
*
func
);
enum
objiter_status
{
OIS_DONE
,
OIS_DATA
,
...
...
bin/varnishd/cache/cache_obj.c
View file @
ef146407
...
...
@@ -231,6 +231,40 @@ ObjIterEnd(struct objcore *oc, void **oix)
FREE_OBJ
(
oi
);
}
int
ObjIterate
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
void
*
priv
,
objiterate_f
*
func
)
{
void
*
oi
;
enum
objiter_status
ois
;
void
*
ptr
;
ssize_t
len
;
oi
=
ObjIterBegin
(
wrk
,
oc
);
do
{
ois
=
ObjIter
(
oc
,
oi
,
&
ptr
,
&
len
);
switch
(
ois
)
{
case
OIS_DONE
:
AZ
(
len
);
break
;
case
OIS_ERROR
:
break
;
case
OIS_DATA
:
if
(
func
(
priv
,
0
,
ptr
,
len
))
ois
=
OIS_ERROR
;
break
;
case
OIS_STREAM
:
if
(
func
(
priv
,
1
,
ptr
,
len
))
ois
=
OIS_ERROR
;
break
;
default:
WRONG
(
"Wrong OIS value"
);
}
}
while
(
ois
==
OIS_DATA
||
ois
==
OIS_STREAM
);
ObjIterEnd
(
oc
,
&
oi
);
return
(
ois
==
OIS_DONE
?
0
:
-
1
);
}
/*--------------------------------------------------------------------
*/
...
...
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