mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
strip any trailing whitespace from source lines. strips off trailing \r from dos files :)
This commit is contained in:
parent
52f7bd4bb4
commit
ab5536ef46
1 changed files with 5 additions and 2 deletions
|
@ -40,6 +40,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -137,7 +138,7 @@ PR_Debug_Init_Cvars (void)
|
|||
static file_t *
|
||||
PR_Load_Source_File (progs_t *pr, const char *fname)
|
||||
{
|
||||
char *path = 0, *l, **dir;
|
||||
char *path = 0, *l, *p, **dir;
|
||||
file_t *f = Hash_Find (file_hash, fname);
|
||||
|
||||
if (f)
|
||||
|
@ -173,7 +174,9 @@ PR_Load_Source_File (progs_t *pr, const char *fname)
|
|||
f->lines[0].text = f->text;
|
||||
for (f->num_lines = 0, l = f->text; *l; l++) {
|
||||
if (*l == '\n') {
|
||||
f->lines[f->num_lines].len = l - f->lines[f->num_lines].text;
|
||||
for (p = l; p > f->lines[f->num_lines].text && isspace(p[-1]); p--)
|
||||
;
|
||||
f->lines[f->num_lines].len = p - f->lines[f->num_lines].text;
|
||||
f->lines[++f->num_lines].text = l + 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue