cleanups while i was trying to figure out how it worked

svn:r12612
This commit is contained in:
Roger Dingledine 2007-11-30 17:23:46 +00:00
parent e9b999ff22
commit 188cb920d0

View File

@ -1889,8 +1889,8 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
* the start of the next line. If we run out of data, return a pointer to the * the start of the next line. If we run out of data, return a pointer to the
* end of the string. If we encounter an error, return NULL. * end of the string. If we encounter an error, return NULL.
* *
* NOTE: We modify <b>line</b> as we parse it, by inserting NULs to terminate * NOTE: We modify *<b>line</b> as we parse it, by inserting NULs
* the key and value. * to terminate the key and value.
*/ */
char * char *
parse_line_from_str(char *line, char **key_out, char **value_out) parse_line_from_str(char *line, char **key_out, char **value_out)
@ -1923,9 +1923,10 @@ parse_line_from_str(char *line, char **key_out, char **value_out)
while (*line && !TOR_ISSPACE(*line) && *line != '#') while (*line && !TOR_ISSPACE(*line) && *line != '#')
++line; ++line;
/* Skip until the value */ /* Skip until the value, writing nuls so key will be nul-terminated */
while (*line == ' ' || *line == '\t') while (*line == ' ' || *line == '\t')
*line++ = '\0'; *line++ = '\0';
val = line; val = line;
/* Find the end of the line. */ /* Find the end of the line. */