summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils/lexparser.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:34:14 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2010-02-23 10:34:14 +0000
commited7d79f96177044949744da10f4431c1d6242241 (patch)
tree3aabaa55ed3b5291daef891cfee9befb5235e2b8 /src/libstrongswan/utils/lexparser.c
parent7410d3c6d6a9a1cd7aa55083c938946af6ff9498 (diff)
downloadvyos-strongswan-ed7d79f96177044949744da10f4431c1d6242241.tar.gz
vyos-strongswan-ed7d79f96177044949744da10f4431c1d6242241.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.3.6)
Diffstat (limited to 'src/libstrongswan/utils/lexparser.c')
-rw-r--r--src/libstrongswan/utils/lexparser.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/libstrongswan/utils/lexparser.c b/src/libstrongswan/utils/lexparser.c
index 2472f6751..b0aced180 100644
--- a/src/libstrongswan/utils/lexparser.c
+++ b/src/libstrongswan/utils/lexparser.c
@@ -40,31 +40,31 @@ bool match(const char *pattern, const chunk_t *ch)
bool extract_token(chunk_t *token, const char termination, chunk_t *src)
{
u_char *eot = memchr(src->ptr, termination, src->len);
-
+
if (termination == ' ')
{
u_char *eot_tab = memchr(src->ptr, '\t', src->len);
-
+
/* check if a tab instead of a space terminates the token */
eot = ( eot_tab == NULL || (eot && eot < eot_tab) ) ? eot : eot_tab;
}
-
+
/* initialize empty token */
*token = chunk_empty;
-
+
if (eot == NULL) /* termination symbol not found */
{
return FALSE;
}
-
+
/* extract token */
token->ptr = src->ptr;
token->len = (u_int)(eot - src->ptr);
-
+
/* advance src pointer after termination symbol */
src->ptr = eot + 1;
src->len -= (token->len + 1);
-
+
return TRUE;
}
@@ -75,23 +75,23 @@ bool extract_token_str(chunk_t *token, const char *termination, chunk_t *src)
{
u_char *eot = memstr(src->ptr, termination, src->len);
size_t l = strlen(termination);
-
+
/* initialize empty token */
*token = chunk_empty;
-
+
if (eot == NULL) /* termination string not found */
{
return FALSE;
}
-
+
/* extract token */
token->ptr = src->ptr;
token->len = (u_int)(eot - src->ptr);
-
+
/* advance src pointer after termination string */
src->ptr = eot + l;
src->len -= (token->len + l);
-
+
return TRUE;
}