mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-11-08 23:27:15 -05:00
saa: fix indentation
Apply standard indentation to the SAA code, not sure why it was different...
This commit is contained in:
34
saa.c
34
saa.c
@@ -51,7 +51,8 @@ static void saa_extend(struct SAA *s)
|
||||
size_t windex = s->wblk - s->blk_ptrs;
|
||||
|
||||
s->nblkptrs <<= 1;
|
||||
s->blk_ptrs = nasm_realloc(s->blk_ptrs, s->nblkptrs*sizeof(char *));
|
||||
s->blk_ptrs =
|
||||
nasm_realloc(s->blk_ptrs, s->nblkptrs * sizeof(char *));
|
||||
|
||||
s->rblk = s->blk_ptrs + rindex;
|
||||
s->wblk = s->blk_ptrs + windex;
|
||||
@@ -66,12 +67,12 @@ void *saa_wstruct(struct SAA *s)
|
||||
void *p;
|
||||
|
||||
if (s->wpos % s->elem_len)
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
|
||||
nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
|
||||
"misaligned wpos in saa_wstruct");
|
||||
|
||||
if (s->wpos + s->elem_len > s->blk_len) {
|
||||
if (s->wpos != s->blk_len)
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
|
||||
nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
|
||||
"unfilled block in saa_wstruct");
|
||||
|
||||
if (s->wptr + s->elem_len > s->length)
|
||||
@@ -134,7 +135,7 @@ void *saa_rstruct(struct SAA *s)
|
||||
return NULL;
|
||||
|
||||
if (s->rpos % s->elem_len)
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
|
||||
nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
|
||||
"misaligned rpos in saa_rstruct");
|
||||
|
||||
if (s->rpos + s->elem_len > s->blk_len) {
|
||||
@@ -149,7 +150,7 @@ void *saa_rstruct(struct SAA *s)
|
||||
return p;
|
||||
}
|
||||
|
||||
const void *saa_rbytes(struct SAA *s, size_t *lenp)
|
||||
const void *saa_rbytes(struct SAA *s, size_t * lenp)
|
||||
{
|
||||
const void *p;
|
||||
size_t len;
|
||||
@@ -184,7 +185,8 @@ void saa_rnbytes(struct SAA *s, void *data, size_t len)
|
||||
char *d = data;
|
||||
|
||||
if (s->rptr + len > s->datalen) {
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_rnbytes");
|
||||
nasm_malloc_error(ERR_PANIC | ERR_NOFILE,
|
||||
"overrun in saa_rnbytes");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -206,14 +208,14 @@ void saa_fread(struct SAA *s, size_t posn, void *data, size_t len)
|
||||
{
|
||||
size_t ix;
|
||||
|
||||
if (posn+len > s->datalen) {
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fread");
|
||||
if (posn + len > s->datalen) {
|
||||
nasm_malloc_error(ERR_PANIC | ERR_NOFILE, "overrun in saa_fread");
|
||||
return;
|
||||
}
|
||||
|
||||
if (likely(s->blk_len == SAA_BLKLEN)) {
|
||||
ix = posn >> SAA_BLKSHIFT;
|
||||
s->rpos = posn & (SAA_BLKLEN-1);
|
||||
s->rpos = posn & (SAA_BLKLEN - 1);
|
||||
} else {
|
||||
ix = posn / s->blk_len;
|
||||
s->rpos = posn % s->blk_len;
|
||||
@@ -231,13 +233,13 @@ void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len)
|
||||
|
||||
if (posn > s->datalen) {
|
||||
/* Seek beyond the end of the existing array not supported */
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fwrite");
|
||||
nasm_malloc_error(ERR_PANIC | ERR_NOFILE, "overrun in saa_fwrite");
|
||||
return;
|
||||
}
|
||||
|
||||
if (likely(s->blk_len == SAA_BLKLEN)) {
|
||||
ix = posn >> SAA_BLKSHIFT;
|
||||
s->wpos = posn & (SAA_BLKLEN-1);
|
||||
s->wpos = posn & (SAA_BLKLEN - 1);
|
||||
} else {
|
||||
ix = posn / s->blk_len;
|
||||
s->wpos = posn % s->blk_len;
|
||||
@@ -333,8 +335,7 @@ void saa_wleb128u(struct SAA *psaa, int value)
|
||||
|
||||
ptemp = temp;
|
||||
len = 0;
|
||||
do
|
||||
{
|
||||
do {
|
||||
byte = value & 127;
|
||||
value >>= 7;
|
||||
if (value != 0) /* more bytes to come */
|
||||
@@ -359,15 +360,14 @@ void saa_wleb128s(struct SAA *psaa, int value)
|
||||
negative = (value < 0);
|
||||
size = sizeof(int) * 8;
|
||||
len = 0;
|
||||
while(more)
|
||||
{
|
||||
while (more) {
|
||||
byte = value & 0x7f;
|
||||
value >>= 7;
|
||||
if (negative)
|
||||
/* sign extend */
|
||||
value |= - (1 <<(size - 7));
|
||||
value |= -(1 << (size - 7));
|
||||
/* sign bit of byte is second high order bit (0x40) */
|
||||
if ((value == 0 && ! (byte & 0x40)) ||
|
||||
if ((value == 0 && !(byte & 0x40)) ||
|
||||
((value == -1) && (byte & 0x40)))
|
||||
more = 0;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user