summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f234b32)
Profiling has shown that it is one of the bottle-necks.
static void statsd_parse_buffer (char *buffer) /* {{{ */
{
static void statsd_parse_buffer (char *buffer) /* {{{ */
{
- char *dummy;
- char *saveptr = NULL;
- char *ptr;
-
- for (dummy = buffer;
- (ptr = strtok_r (dummy, "\r\n", &saveptr)) != NULL;
- dummy = NULL)
- char *line_orig = sstrdup (ptr);
+ char orig[64];
+ char *next;
- status = statsd_parse_line (ptr);
+ next = strchr (buffer, '\n');
+ if (next != NULL)
+ {
+ *next = 0;
+ next++;
+ }
+
+ if (*buffer == 0)
+ {
+ buffer = next;
+ continue;
+ }
+
+ sstrncpy (orig, buffer, sizeof (orig));
+
+ status = statsd_parse_line (buffer);
- ERROR ("statsd plugin: Unable to parse line: \"%s\"", line_orig);
+ ERROR ("statsd plugin: Unable to parse line: \"%s\"", orig);
}
} /* }}} void statsd_parse_buffer */
}
} /* }}} void statsd_parse_buffer */