projects
/
freeradius.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5f62444
)
hoist unquoted case to top of the loop
author
Alan T. DeKok
<aland@freeradius.org>
Wed, 31 Aug 2016 14:02:49 +0000
(10:02 -0400)
committer
Alan T. DeKok
<aland@freeradius.org>
Wed, 31 Aug 2016 14:26:27 +0000
(10:26 -0400)
src/lib/token.c
patch
|
blob
|
history
diff --git
a/src/lib/token.c
b/src/lib/token.c
index
b7f5040
..
85e7080
100644
(file)
--- a/
src/lib/token.c
+++ b/
src/lib/token.c
@@
-231,6
+231,33
@@
static FR_TOKEN getthing(char const **ptr, char *buf, int buflen, bool tok,
s = buf;
while (*p && buflen-- > 1) {
s = buf;
while (*p && buflen-- > 1) {
+ /*
+ * We're looking for strings. Stop on spaces, or
+ * (if given a token list), on a token, or on a
+ * comma.
+ */
+ if (!quote) {
+ if (isspace((int) *p)) {
+ break;
+ }
+
+ if (tok) {
+ for (t = tokenlist; t->name; t++) {
+ if (TOKEN_MATCH(p, t->name)) {
+ *s++ = 0;
+ goto done;
+ }
+ }
+ }
+ if (*p == ',') break;
+
+ /*
+ * Copy the character over.
+ */
+ *s++ = *p++;
+ continue;
+ }
+
if (unescape && quote && (*p == '\\')) {
p++;
if (unescape && quote && (*p == '\\')) {
p++;
@@
-283,27
+310,6
@@
static FR_TOKEN getthing(char const **ptr, char *buf, int buflen, bool tok,
p++;
break;
}
p++;
break;
}
-
- /*
- * We're looking for strings. Stop on spaces, or
- * (if given a token list), on a token, or on a
- * comma.
- */
- if (!quote) {
- if (isspace((int) *p)) {
- break;
- }
-
- if (tok) {
- for (t = tokenlist; t->name; t++) {
- if (TOKEN_MATCH(p, t->name)) {
- *s++ = 0;
- goto done;
- }
- }
- }
- if (*p == ',') break;
- }
*s++ = *p++;
}
*s++ = *p++;
}