recomputing it.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14542
dc483132-0cff-0310-8789-
dd5450dbe970
2002-06-19 Ken Raeburn <raeburn@mit.edu>
+ * prof_parse.c (strip_line): Simplify loop by preserving "p"
+ rather than recomputing it.
+
* configure.in: Look for strdup.
* prof_tree.c (profile_create_node): Use strdup.
(strdup, MYstrdup): Define it if the OS doesn't provide it.
static void strip_line(line)
char *line;
{
- char *p;
-
- while (*line) {
- p = line + strlen(line) - 1;
- if ((*p == '\n') || (*p == '\r'))
- *p = 0;
- else
- break;
- }
+ char *p = line + strlen(line);
+ while (p > line && (p[-1] == '\n' || p[-1] == '\r'))
+ *p-- = 0;
}
static void parse_quoted_string(char *str)