summaryrefslogtreecommitdiff
path: root/nasmlib.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2016-02-16 17:37:18 -0800
committerH. Peter Anvin <hpa@linux.intel.com>2016-02-16 17:37:18 -0800
commit2c4a4d5810d0a59b033a07876a2648ef5d4c2859 (patch)
treeb11e01c8955b420826da10ee46b94da92e2c7bcc /nasmlib.c
parent6fc2b123afaaf57577581a7680aa41fe101fd86b (diff)
downloadnasm-2c4a4d5810d0a59b033a07876a2648ef5d4c2859.tar.gz
Simplify handling of segments and segalign
Slightly simplify the handling of segment number allocation. If we are in absolute space, never push a segalign down to the backend. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'nasmlib.c')
-rw-r--r--nasmlib.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/nasmlib.c b/nasmlib.c
index 656350d5..cf39468a 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -391,16 +391,14 @@ int64_t readstrnum(char *str, int length, bool *warn)
return charconst;
}
-static int32_t next_seg;
-
-void seg_init(void)
-{
- next_seg = 0;
-}
-
int32_t seg_alloc(void)
{
- return (next_seg += 2) - 2;
+ static int32_t next_seg = 0;
+ int32_t this_seg = next_seg;
+
+ next_seg += 2;
+
+ return this_seg;
}
#ifdef WORDS_LITTLEENDIAN