aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/lexparser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/utils/lexparser.c')
-rw-r--r--src/libstrongswan/utils/lexparser.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/src/libstrongswan/utils/lexparser.c b/src/libstrongswan/utils/lexparser.c
index c351e7e24..c1816d6eb 100644
--- a/src/libstrongswan/utils/lexparser.c
+++ b/src/libstrongswan/utils/lexparser.c
@@ -14,16 +14,8 @@
* $Id$
*/
-/* memrchr is a GNU extension */
-#define _GNU_SOURCE
-#include <string.h>
-
#include "lexparser.h"
-#ifndef HAVE_MEMRCHR
-void *memrchr(const void *s, int c, size_t n);
-#endif
-
/**
* eat whitespace
*/
@@ -33,7 +25,7 @@ bool eat_whitespace(chunk_t *src)
{
src->ptr++; src->len--;
}
- return src->len > 0 && *src->ptr != '#';
+ return src->len > 0 && *src->ptr != '#';
}
/**
@@ -54,11 +46,11 @@ bool extract_token(chunk_t *token, const char termination, chunk_t *src)
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;
@@ -106,32 +98,6 @@ bool extract_token_str(chunk_t *token, const char *termination, chunk_t *src)
}
/**
- * extracts a token ending with the last occurrence of a given termination symbol
- */
-bool extract_last_token(chunk_t *token, const char termination, chunk_t *src)
-{
- u_char *eot = memrchr(src->ptr, termination, src->len);
-
- /* 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;
-}
-
-/**
* fetches a new line terminated by \n or \r\n
*/
bool fetchline(chunk_t *src, chunk_t *line)