|
From: <sv...@va...> - 2011-12-26 18:40:08
|
Author: florian
Date: 2011-12-26 18:35:29 +0000 (Mon, 26 Dec 2011)
New Revision: 12318
Log:
While investigating whether bugzilla #286040 was a problem or
not (it's not) I noticed that the code was more complex than
it needed to be. So this patch simplifies it a little.
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr-linux.c
Modified: trunk/coregrind/m_aspacemgr/aspacemgr-linux.c
===================================================================
--- trunk/coregrind/m_aspacemgr/aspacemgr-linux.c 2011-12-26 18:30:18 UTC (rev 12317)
+++ trunk/coregrind/m_aspacemgr/aspacemgr-linux.c 2011-12-26 18:35:29 UTC (rev 12318)
@@ -3299,19 +3299,21 @@
read_line_ok:
+ aspacem_assert(i < buf_n_tot);
+
/* Try and find the name of the file mapped to this segment, if
- it exists. Note that files can contains spaces. */
+ it exists. Note that file names can contain spaces. */
- // Move i to the next non-space char, which should be either a '/' or
- // a newline.
- while (procmap_buf[i] == ' ' && i < buf_n_tot-1) i++;
+ // Move i to the next non-space char, which should be either a '/',
+ // a '[', or a newline.
+ while (procmap_buf[i] == ' ') i++;
// Move i_eol to the end of the line.
i_eol = i;
- while (procmap_buf[i_eol] != '\n' && i_eol < buf_n_tot-1) i_eol++;
+ while (procmap_buf[i_eol] != '\n') i_eol++;
// If there's a filename...
- if (i < i_eol-1 && procmap_buf[i] == '/') {
+ if (procmap_buf[i] == '/') {
/* Minor hack: put a '\0' at the filename end for the call to
'record_mapping', then restore the old char with 'tmp'. */
filename = &procmap_buf[i];
|