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
dddb171b
Commit
dddb171b
authored
Aug 17, 2023
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vte: Beginning of an incremental API
parent
80d78148
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
0 deletions
+81
-0
Makefile.am
include/Makefile.am
+1
-0
vte.h
include/vte.h
+33
-0
vte.c
lib/libvarnish/vte.c
+47
-0
No files found.
include/Makefile.am
View file @
dddb171b
...
...
@@ -80,6 +80,7 @@ nobase_pkginclude_HEADERS += \
vsb.h
\
vsha256.h
\
vtcp.h
\
vte.h
\
vtim.h
\
vtree.h
\
vrnd.h
...
...
include/vte.h
0 → 100644
View file @
dddb171b
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2023 Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
struct
vte
;
struct
vte
*
VTE_new
(
int
maxfields
,
int
width
);
void
VTE_destroy
(
struct
vte
**
);
lib/libvarnish/vte.c
View file @
dddb171b
...
...
@@ -37,13 +37,60 @@
#include "vdef.h"
#include "vqueue.h"
#include "miniobj.h"
#include "vas.h"
#include "vcli_serve.h"
#include "vsb.h"
#include "vte.h"
#define MAXCOL 10
struct
vte
{
unsigned
magic
;
#define VTE_MAGIC 0xedf42b97
struct
vsb
*
vsb
;
int
c_off
;
/* input char offset */
int
l_sz
;
/* input line size */
int
l_maxsz
;
/* maximum input line size */
int
o_sz
;
/* output sz */
int
o_sep
;
/* output field separators */
int
f_off
;
/* input field offset */
int
f_sz
;
/* input field size */
int
f_cnt
;
/* actual number of fields */
int
f_maxcnt
;
/* maximum number of fields */
int
f_maxsz
[];
/* maximum size per field */
};
struct
vte
*
VTE_new
(
int
maxfields
,
int
width
)
{
struct
vte
*
vte
;
assert
(
maxfields
>
0
);
assert
(
width
>
0
);
ALLOC_FLEX_OBJ
(
vte
,
f_maxsz
,
maxfields
,
VTE_MAGIC
);
if
(
vte
!=
NULL
)
{
vte
->
o_sz
=
width
;
vte
->
f_maxcnt
=
maxfields
;
vte
->
vsb
=
VSB_new_auto
();
AN
(
vte
->
vsb
);
}
return
(
vte
);
}
void
VTE_destroy
(
struct
vte
**
vtep
)
{
struct
vte
*
vte
;
TAKE_OBJ_NOTNULL
(
vte
,
vtep
,
VTE_MAGIC
);
AN
(
vte
->
vsb
);
VSB_destroy
(
&
vte
->
vsb
);
FREE_OBJ
(
vte
);
}
void
VCLI_VTE
(
struct
cli
*
cli
,
struct
vsb
**
src
,
int
width
)
{
...
...
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