summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2009-10-30 09:24:05 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2009-10-31 20:03:29 +0300
commita353955a8ded9d3e3401df159fe2c1fa65467f55 (patch)
tree75e53c8fbc00e90c09d1fbfcd0c5eec7bd26d2e7 /output
parent54e94a56e27f73fc2831637ad9039a00eb5e6347 (diff)
downloadnasm-a353955a8ded9d3e3401df159fe2c1fa65467f55.tar.gz
nasm-a353955a8ded9d3e3401df159fe2c1fa65467f55.tar.bz2
nasm-a353955a8ded9d3e3401df159fe2c1fa65467f55.zip
output/outelf32-64: use string helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'output')
-rw-r--r--output/outelf32.c22
-rw-r--r--output/outelf64.c22
2 files changed, 12 insertions, 32 deletions
diff --git a/output/outelf32.c b/output/outelf32.c
index 32e7d09..c491fdd 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -359,23 +359,18 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
return def_seg;
}
- p = name;
- while (*p && !nasm_isspace(*p))
- p++;
+ p = nasm_skip_word(name);
if (*p)
*p++ = '\0';
flags_and = flags_or = type = align = 0;
- while (*p && nasm_isspace(*p))
- p++;
+ p = nasm_skip_spaces(p);
while (*p) {
char *q = p;
- while (*p && !nasm_isspace(*p))
- p++;
+ p = nasm_skip_word(p);
if (*p)
*p++ = '\0';
- while (*p && nasm_isspace(*p))
- p++;
+ p = nasm_skip_spaces(p);
if (!nasm_strnicmp(q, "align=", 6)) {
align = atoi(q + 6);
@@ -488,12 +483,8 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
if (!strcmp((*s)->name, name)) {
struct tokenval tokval;
expr *e;
- char *p = special;
+ char *p = nasm_skip_spaces(nasm_skip_word(special));
- while (*p && !nasm_isspace(*p))
- p++;
- while (*p && nasm_isspace(*p))
- p++;
stdscan_reset();
stdscan_set(p);
tokval.t_type = TOKEN_INVALID;
@@ -609,8 +600,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
n, special);
special += n;
- while (nasm_isspace(*special))
- ++special;
+ special = nasm_skip_spaces(special);
if (*special) {
n = strcspn(special, " \t");
if (!nasm_strnicmp(special, "default", n))
diff --git a/output/outelf64.c b/output/outelf64.c
index 3c42484..5713f09 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -363,23 +363,18 @@ static int32_t elf_section_names(char *name, int pass, int *bits)
return def_seg;
}
- p = name;
- while (*p && !nasm_isspace(*p))
- p++;
+ p = nasm_skip_word(name);
if (*p)
*p++ = '\0';
flags_and = flags_or = type = align = 0;
- while (*p && nasm_isspace(*p))
- p++;
+ p = nasm_skip_spaces(p);
while (*p) {
char *q = p;
- while (*p && !nasm_isspace(*p))
- p++;
+ p = nasm_skip_word(p);
if (*p)
*p++ = '\0';
- while (*p && nasm_isspace(*p))
- p++;
+ p = nasm_skip_spaces(p);
if (!nasm_strnicmp(q, "align=", 6)) {
align = atoi(q + 6);
@@ -492,12 +487,8 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
if (!strcmp((*s)->name, name)) {
struct tokenval tokval;
expr *e;
- char *p = special;
+ char *p = nasm_skip_spaces(nasm_skip_word(special));
- while (*p && !nasm_isspace(*p))
- p++;
- while (*p && nasm_isspace(*p))
- p++;
stdscan_reset();
stdscan_set(p);
tokval.t_type = TOKEN_INVALID;
@@ -614,8 +605,7 @@ static void elf_deflabel(char *name, int32_t segment, int64_t offset,
n, special);
special += n;
- while (nasm_isspace(*special))
- ++special;
+ special = nasm_skip_spaces(special);
if (*special) {
n = strcspn(special, " \t");
if (!nasm_strnicmp(special, "default", n))