| 166 | }; |
| 167 | |
| 168 | static unsigned int |
| 169 | count_lines (const char *data) |
| 170 | { |
| 171 | unsigned int count = 0; |
| 172 | const char *p = data; |
| 173 | |
| 174 | while (*p != 0) |
| 175 | { |
| 176 | if (*p == '\n') |
| 177 | count++; |
| 178 | p++; |
| 179 | } |
| 180 | |
| 181 | /* If missing final newline, add one */ |
| 182 | if (p > data && *(p-1) != '\n') |
| 183 | count++; |
| 184 | |
| 185 | return count; |
| 186 | } |
| 187 | |
| 188 | static int |
| 189 | count_mounts (MountInfoLine *line) |