From: Ken Raeburn Date: Wed, 19 Jun 2002 21:03:00 +0000 (+0000) Subject: * prof_parse.c (strip_line): Simplify loop by preserving "p" rather than X-Git-Tag: krb5-1.3-alpha1~677 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bb0505f17bd565d93cc0a43eb40ea6ecac8a912c;p=krb5.git * prof_parse.c (strip_line): Simplify loop by preserving "p" rather than recomputing it. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14542 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index d9f30d867..83bbca78b 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,5 +1,8 @@ 2002-06-19 Ken Raeburn + * 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. diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index 844d66a57..019fabe25 100644 --- a/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c @@ -32,15 +32,9 @@ static char *skip_over_blanks(cp) 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)