aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-28 11:46:32 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-28 11:46:32 -0400
commit30166261bb1e523db1199ea422c9bf09f30de69f (patch)
tree94843d489623f61d4403e1ad0552ceb28f25b1b2 /src/common/util.c
parent48ebd9bf76a0e5ff60b88f8906919016de82e819 (diff)
downloadtor-30166261bb1e523db1199ea422c9bf09f30de69f.tar.gz
tor-30166261bb1e523db1199ea422c9bf09f30de69f.zip
Move string_is_key_value to lib/encoding
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 304101ec0e..5a104d39f1 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -225,39 +225,6 @@ add_laplace_noise(int64_t signal_, double random_, double delta_f,
* String manipulation
* ===== */
-/** Return true if <b>string</b> is a valid 'key=[value]' string.
- * "value" is optional, to indicate the empty string. Log at logging
- * <b>severity</b> if something ugly happens. */
-int
-string_is_key_value(int severity, const char *string)
-{
- /* position of equal sign in string */
- const char *equal_sign_pos = NULL;
-
- tor_assert(string);
-
- if (strlen(string) < 2) { /* "x=" is shortest args string */
- tor_log(severity, LD_GENERAL, "'%s' is too short to be a k=v value.",
- escaped(string));
- return 0;
- }
-
- equal_sign_pos = strchr(string, '=');
- if (!equal_sign_pos) {
- tor_log(severity, LD_GENERAL, "'%s' is not a k=v value.", escaped(string));
- return 0;
- }
-
- /* validate that the '=' is not in the beginning of the string. */
- if (equal_sign_pos == string) {
- tor_log(severity, LD_GENERAL, "'%s' is not a valid k=v value.",
- escaped(string));
- return 0;
- }
-
- return 1;
-}
-
/** Return a newly allocated string equal to <b>string</b>, except that every
* character in <b>chars_to_escape</b> is preceded by a backslash. */
char *