diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2013-02-15 12:22:27 +0400 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2013-02-15 12:22:27 +0400 |
commit | f831645ed8dac3bb545876d19e631c5c789181ca (patch) | |
tree | ee5b8551f6d7a35995273702947ff83eab0fa055 /nasm.c | |
parent | 331fd7c8aa3c0c11cbd4d95470c6ac079c7b628b (diff) | |
download | nasm-f831645ed8dac3bb545876d19e631c5c789181ca.tar.gz nasm-f831645ed8dac3bb545876d19e631c5c789181ca.tar.bz2 nasm-f831645ed8dac3bb545876d19e631c5c789181ca.zip |
nasm.c: Tabs to spaces in copy_filename
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'nasm.c')
-rw-r--r-- | nasm.c | 104 |
1 files changed, 52 insertions, 52 deletions
@@ -536,74 +536,74 @@ static char *quote_for_make(const char *str) const char *p; char *os, *q; - size_t n = 1; /* Terminating zero */ + size_t n = 1; /* Terminating zero */ size_t nbs = 0; if (!str) - return NULL; + return NULL; for (p = str; *p; p++) { - switch (*p) { - case ' ': - case '\t': - /* Convert N backslashes + ws -> 2N+1 backslashes + ws */ - n += nbs + 2; - nbs = 0; - break; - case '$': - case '#': - nbs = 0; - n += 2; - break; - case '\\': - nbs++; - n++; - break; - default: - nbs = 0; - n++; - break; - } + switch (*p) { + case ' ': + case '\t': + /* Convert N backslashes + ws -> 2N+1 backslashes + ws */ + n += nbs + 2; + nbs = 0; + break; + case '$': + case '#': + nbs = 0; + n += 2; + break; + case '\\': + nbs++; + n++; + break; + default: + nbs = 0; + n++; + break; + } } /* Convert N backslashes at the end of filename to 2N backslashes */ if (nbs) - n += nbs; + n += nbs; os = q = nasm_malloc(n); nbs = 0; for (p = str; *p; p++) { - switch (*p) { - case ' ': - case '\t': - while (nbs--) - *q++ = '\\'; - *q++ = '\\'; - *q++ = *p; - break; - case '$': - *q++ = *p; - *q++ = *p; - nbs = 0; - break; - case '#': - *q++ = '\\'; - *q++ = *p; - nbs = 0; - break; - case '\\': - *q++ = *p; - nbs++; - break; - default: - *q++ = *p; - nbs = 0; - break; - } + switch (*p) { + case ' ': + case '\t': + while (nbs--) + *q++ = '\\'; + *q++ = '\\'; + *q++ = *p; + break; + case '$': + *q++ = *p; + *q++ = *p; + nbs = 0; + break; + case '#': + *q++ = '\\'; + *q++ = *p; + nbs = 0; + break; + case '\\': + *q++ = *p; + nbs++; + break; + default: + *q++ = *p; + nbs = 0; + break; + } } while (nbs--) - *q++ = '\\'; + *q++ = '\\'; *q = '\0'; |