[master] 0848a1f Weed out some unused functions which are surplus to our requirements.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Feb 24 22:40:38 CET 2015
commit 0848a1fe471c40a49e77df941c8e2cc133170ff7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Feb 24 21:39:59 2015 +0000
Weed out some unused functions which are surplus to our requirements.
diff --git a/include/vsa.h b/include/vsa.h
index 996afde..185be03 100644
--- a/include/vsa.h
+++ b/include/vsa.h
@@ -34,7 +34,6 @@ struct suckaddr;
extern const int vsa_suckaddr_len;
int VSA_Sane(const struct suckaddr *);
-socklen_t VSA_Len(const struct suckaddr *);
unsigned VSA_Port(const struct suckaddr *);
int VSA_Compare(const struct suckaddr *, const struct suckaddr *);
struct suckaddr *VSA_Clone(const struct suckaddr *sua);
diff --git a/include/vsb.h b/include/vsb.h
index 3734361..0f1f2bd 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -62,11 +62,8 @@ struct vsb *VSB_new(struct vsb *, char *, int, int);
#define VSB_new_auto() \
VSB_new(NULL, NULL, 0, VSB_AUTOEXTEND)
void VSB_clear(struct vsb *);
-int VSB_setpos(struct vsb *, ssize_t);
int VSB_bcat(struct vsb *, const void *, size_t);
-int VSB_bcpy(struct vsb *, const void *, size_t);
int VSB_cat(struct vsb *, const char *);
-int VSB_cpy(struct vsb *, const char *);
int VSB_printf(struct vsb *, const char *, ...)
__printflike(2, 3);
#ifdef va_start
@@ -74,15 +71,12 @@ int VSB_vprintf(struct vsb *, const char *, va_list)
__printflike(2, 0);
#endif
int VSB_putc(struct vsb *, int);
-int VSB_trim(struct vsb *);
int VSB_error(const struct vsb *);
int VSB_finish(struct vsb *);
char *VSB_data(const struct vsb *);
ssize_t VSB_len(const struct vsb *);
-int VSB_done(const struct vsb *);
void VSB_delete(struct vsb *);
void VSB_quote(struct vsb *s, const char *p, int len, int how);
-const char *VSB_unquote(struct vsb *s, const char *p, int len, int how);
#ifdef __cplusplus
};
#endif
diff --git a/lib/libvarnish/vsa.c b/lib/libvarnish/vsa.c
index 146a212..be0ebc4 100644
--- a/lib/libvarnish/vsa.c
+++ b/lib/libvarnish/vsa.c
@@ -307,21 +307,6 @@ VSA_Sane(const struct suckaddr *sua)
}
}
-socklen_t
-VSA_Len(const struct suckaddr *sua)
-{
- CHECK_OBJ_NOTNULL(sua, SUCKADDR_MAGIC);
-
- switch(sua->sa.sa_family) {
- case PF_INET:
- return (sizeof(sua->sa4));
- case PF_INET6:
- return (sizeof(sua->sa6));
- default:
- return (0);
- }
-}
-
int
VSA_Compare(const struct suckaddr *sua1, const struct suckaddr *sua2)
{
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index 91a7fa2..7b17e0f 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -234,29 +234,6 @@ VSB_clear(struct vsb *s)
}
/*
- * Set the vsb's end position to an arbitrary value.
- * Effectively truncates the vsb at the new position.
- */
-int
-VSB_setpos(struct vsb *s, ssize_t pos)
-{
-
- assert_VSB_integrity(s);
- assert_VSB_state(s, 0);
-
- KASSERT(pos >= 0,
- ("attempt to seek to a negative position (%jd)", (intmax_t)pos));
- KASSERT(pos < s->s_size,
- ("attempt to seek past end of vsb (%jd >= %jd)",
- (intmax_t)pos, (intmax_t)s->s_size));
-
- if (pos < 0 || pos > s->s_len)
- return (-1);
- s->s_len = pos;
- return (0);
-}
-
-/*
* Append a byte to an vsb. This is the core function for appending
* to an vsb and is the main place that deals with extending the
* buffer and marking overflow.
@@ -302,20 +279,6 @@ VSB_bcat(struct vsb *s, const void *buf, size_t len)
}
/*
- * Copy a byte string into an vsb.
- */
-int
-VSB_bcpy(struct vsb *s, const void *buf, size_t len)
-{
-
- assert_VSB_integrity(s);
- assert_VSB_state(s, 0);
-
- VSB_clear(s);
- return (VSB_bcat(s, buf, len));
-}
-
-/*
* Append a string to an vsb.
*/
int
@@ -337,20 +300,6 @@ VSB_cat(struct vsb *s, const char *str)
}
/*
- * Copy a string into an vsb.
- */
-int
-VSB_cpy(struct vsb *s, const char *str)
-{
-
- assert_VSB_integrity(s);
- assert_VSB_state(s, 0);
-
- VSB_clear(s);
- return (VSB_cat(s, str));
-}
-
-/*
* Format the given argument list and append the resulting string to an vsb.
*/
int
@@ -439,25 +388,6 @@ VSB_putc(struct vsb *s, int c)
}
/*
- * Trim whitespace characters from end of an vsb.
- */
-int
-VSB_trim(struct vsb *s)
-{
-
- assert_VSB_integrity(s);
- assert_VSB_state(s, 0);
-
- if (s->s_error != 0)
- return (-1);
-
- while (s->s_len > 0 && isspace(s->s_buf[s->s_len-1]))
- --s->s_len;
-
- return (0);
-}
-
-/*
* Check if an vsb has an error.
*/
int
@@ -533,16 +463,6 @@ VSB_delete(struct vsb *s)
}
/*
- * Check if an vsb has been finished.
- */
-int
-VSB_done(const struct vsb *s)
-{
-
- return(VSB_ISFINISHED(s));
-}
-
-/*
* Quote a string
*/
void
@@ -595,60 +515,3 @@ VSB_quote(struct vsb *s, const char *p, int len, int how)
}
(void)VSB_putc(s, '"');
}
-
-/*
- * Unquote a string
- */
-const char *
-VSB_unquote(struct vsb *s, const char *p, int len, int how)
-{
- const char *q;
- char *r;
- unsigned long u;
- char c;
-
- (void)how; /* For future enhancements */
-
- if (len == -1)
- len = strlen(p);
-
- for (q = p; q < p + len; q++) {
- if (*q != '\\') {
- (void)VSB_bcat(s, q, 1);
- continue;
- }
- if (++q >= p + len)
- return ("Incomplete '\\'-sequence at end of string");
-
- switch(*q) {
- case 'n':
- (void)VSB_bcat(s, "\n", 1);
- continue;
- case 'r':
- (void)VSB_bcat(s, "\r", 1);
- continue;
- case 't':
- (void)VSB_bcat(s, "\t", 1);
- continue;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- errno = 0;
- u = strtoul(q, &r, 8);
- if (errno != 0 || (u & ~0xff))
- return ("\\ooo sequence out of range");
- c = (char)u;
- (void)VSB_bcat(s, &c, 1);
- q = r - 1;
- continue;
- default:
- (void)VSB_bcat(s, q, 1);
- }
- }
- return (NULL);
-}
More information about the varnish-commit
mailing list