[master] 084233429 vte: Remove the former all-in-one VCLI_VTE()
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Aug 21 20:52:08 UTC 2023
commit 0842334295b772925f2a4b6fb7e6387a05ff180c
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Thu Aug 17 15:56:46 2023 +0200
vte: Remove the former all-in-one VCLI_VTE()
diff --git a/include/vcli_serve.h b/include/vcli_serve.h
index 00eae9c83..e1b721ea4 100644
--- a/include/vcli_serve.h
+++ b/include/vcli_serve.h
@@ -111,6 +111,3 @@ cli_func_t VCLS_func_ping_json;
/* VTE integration */
int VCLI_VTE_format(void *priv, const char *fmt, ...) v_printflike_(2, 3);
-
-/* From libvarnish/vte.c */
-void VCLI_VTE(struct cli *cli, struct vsb **src, int width);
diff --git a/include/vte.h b/include/vte.h
index eb5d3ff65..2b57cfb3b 100644
--- a/include/vte.h
+++ b/include/vte.h
@@ -25,6 +25,14 @@
* 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.
+ *
+ * Varnish Turbo Encabulator
+ *
+ * Align and print fields in a line-based output. Fields are delimited
+ * with a horizontal tab HT and lines starting with a space SP are kept
+ * verbatim. Lines are delimited with a single new line LF character.
+ *
+ * Using non-ASCII or non-printable ASCII character is undefined behavior.
*/
struct vte;
diff --git a/lib/libvarnish/vte.c b/lib/libvarnish/vte.c
index db7d0d2d0..6216cbab6 100644
--- a/lib/libvarnish/vte.c
+++ b/lib/libvarnish/vte.c
@@ -3,6 +3,7 @@
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ * Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*
@@ -34,21 +35,17 @@
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h> /* for MUSL (ssize_t) */
#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
#define MINSEP 1
#define MAXSEP 3
@@ -283,46 +280,3 @@ VTE_format(struct vte *vte, VTE_format_f *func, void *priv)
return (0);
}
-
-/* NB: cheating in the absence of a VCLI_Outv() */
-static int
-vcli_vte(void *priv, const char *fmt, ...)
-{
- struct cli *cli;
- va_list ap;
- char buf[2];
-
- cli = priv;
- AN(cli);
-
- va_start(ap, fmt);
- (void)vsnprintf(buf, sizeof buf, fmt, ap);
- va_end(ap);
-
- VCLI_Out(cli, "%c", *buf);
- return (0);
-}
-
-void
-VCLI_VTE(struct cli *cli, struct vsb **src, int width)
-{
- struct vte *vte;
-
- AN(cli);
- AN(src);
- AN(*src);
- AZ(VSB_finish(*src));
- if (VSB_len(*src) == 0) {
- VSB_destroy(src);
- return;
- }
-
- vte = VTE_new(MAXCOL, width);
- AN(vte);
- AZ(VTE_cat(vte, VSB_data(*src)));
- AZ(VTE_finish(vte));
- AZ(VTE_format(vte, vcli_vte, cli));
- VTE_destroy(&vte);
-
- VSB_destroy(src);
-}
More information about the varnish-commit
mailing list