[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix indentation to spaces only
From: |
Tim Rühsen |
Subject: |
[PATCH] Fix indentation to spaces only |
Date: |
Wed, 1 Apr 2020 12:55:48 +0200 |
2020-04-01 Tim Rühsen <address@hidden>
* .x-sc_space_tab: Remove wildcards, list single files.
* src/ios.c: Replace indenting tabs by 8 spaces each.
* src/pk-cmd.c: Likewise.
* src/pk-editor.c: Likewise.
* src/pk-info.c: Likewise.
* src/pk-ios.c: Likewise.
* src/pk-misc.c: Likewise.
* src/pk-repl.c: Likewise.
* src/pk-set.c: Likewise.
* src/pk-utils.c: Likewise.
* src/pkl-env.c: Likewise.
* src/pkl-env.h: Likewise.
* src/pkl-gen.pks: Likewise.
---
.x-sc_space_tab | 5 +-
src/ios.c | 1150 +++++++++++++++++++++++------------------------
src/pk-cmd.c | 62 +--
src/pk-editor.c | 2 +-
src/pk-info.c | 10 +-
src/pk-ios.c | 12 +-
src/pk-misc.c | 58 +--
src/pk-repl.c | 48 +-
src/pk-set.c | 12 +-
src/pk-utils.c | 2 +-
src/pkl-env.c | 18 +-
src/pkl-env.h | 4 +-
src/pkl-gen.pks | 12 +-
13 files changed, 699 insertions(+), 696 deletions(-)
diff --git a/.x-sc_space_tab b/.x-sc_space_tab
index 71bcfc6c..0ca19ff6 100644
--- a/.x-sc_space_tab
+++ b/.x-sc_space_tab
@@ -1 +1,4 @@
-src/*
+src/pkl-lex.c
+src/pkl-lex.h
+src/pkl-tab.y
+src/ios.c
diff --git a/src/ios.c b/src/ios.c
index d44159b3..ebf5f5bc 100644
--- a/src/ios.c
+++ b/src/ios.c
@@ -43,7 +43,7 @@
#define IOS_PUT_C_ERR_CHCK(c, io, len, off) \
{ \
if ((io)->dev_if->pwrite ((io)->dev, c, len, off) \
- == IOD_EOF) \
+ == IOD_EOF) \
return IOS_EIOBJ; \
}
@@ -304,9 +304,9 @@ ios_map (ios_map_fn cb, void *data)
static inline int
ios_read_int_common (ios io, ios_off offset, int flags,
- int bits,
- enum ios_endian endian,
- uint64_t *value)
+ int bits,
+ enum ios_endian endian,
+ uint64_t *value)
{
/* 64 bits might span at most 9 bytes. */
uint8_t c[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -336,29 +336,29 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[1], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- if (bits <= 8)
- /* We need to shift to align the least significant bit. */
- *value = (c[0] << lastbyte_bits) | (c[1] >> (8 - lastbyte_bits));
- else if ((offset % 8) == 0)
- /* If little endian and the least significant byte is 8 bits aligned,
- then we can handle the information byte by byte as we read. */
- *value = (c[1] << lastbyte_bits) | c[0];
- else
- {
- /* Consider the order of bits in a little endian number:
- 7-6-5-4-3-2-1-0-15-14-13-12-11-10-9-8- ... If such an
- encoding is not byte-aligned, we have to first shift to fill the
- least significant byte to get the right bits in the same bytes. */
- uint64_t reg;
- reg = (c[0] << (8 + offset % 8)) | (c[1] << offset % 8);
- *value = ((reg & 0xff) << (bits % 8)) | (reg >> 8);
- }
+ if (bits <= 8)
+ /* We need to shift to align the least significant bit. */
+ *value = (c[0] << lastbyte_bits) | (c[1] >> (8 - lastbyte_bits));
+ else if ((offset % 8) == 0)
+ /* If little endian and the least significant byte is 8 bits aligned,
+ then we can handle the information byte by byte as we read. */
+ *value = (c[1] << lastbyte_bits) | c[0];
+ else
+ {
+ /* Consider the order of bits in a little endian number:
+ 7-6-5-4-3-2-1-0-15-14-13-12-11-10-9-8- ... If such an
+ encoding is not byte-aligned, we have to first shift to fill the
+ least significant byte to get the right bits in the same bytes. */
+ uint64_t reg;
+ reg = (c[0] << (8 + offset % 8)) | (c[1] << offset % 8);
+ *value = ((reg & 0xff) << (bits % 8)) | (reg >> 8);
+ }
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = (c[0] << lastbyte_bits) | (c[1] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = (c[0] << lastbyte_bits) | (c[1] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -366,36 +366,36 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[2], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- if ((offset % 8) == 0)
- /* If little endian and the least significant byte is 8 bits aligned,
- then we can handle the information byte by byte as we read. */
- *value = (c[2] << (8 + lastbyte_bits)) | (c[1] << 8) | c[0];
- else
- {
- /* We have to shift to fill the least significant byte to get
- the right bits in the same bytes. */
- uint64_t reg;
- reg = ((uint64_t) c[0] << (56 + offset % 8))
- | ((uint64_t) c[1] << (48 + offset % 8))
- | ((uint64_t) c[2] << (40 + offset % 8));
- /* The bits in the most-significant-byte-to-be is aligned to left,
- shift it towards right! */
- if (bits <= 16)
- reg = ((reg & 0x00ff000000000000LL) >> (16 - bits))
- | (reg & 0xff00ffffffffffffLL);
- else
- reg = ((reg & 0x0000ff0000000000LL) >> (24 - bits))
- | (reg & 0xffff00ffffffffffLL);
- /* Now we can place the bytes correctly. */
- *value = __bswap_64(reg);
- }
+ if ((offset % 8) == 0)
+ /* If little endian and the least significant byte is 8 bits aligned,
+ then we can handle the information byte by byte as we read. */
+ *value = (c[2] << (8 + lastbyte_bits)) | (c[1] << 8) | c[0];
+ else
+ {
+ /* We have to shift to fill the least significant byte to get
+ the right bits in the same bytes. */
+ uint64_t reg;
+ reg = ((uint64_t) c[0] << (56 + offset % 8))
+ | ((uint64_t) c[1] << (48 + offset % 8))
+ | ((uint64_t) c[2] << (40 + offset % 8));
+ /* The bits in the most-significant-byte-to-be is aligned to left,
+ shift it towards right! */
+ if (bits <= 16)
+ reg = ((reg & 0x00ff000000000000LL) >> (16 - bits))
+ | (reg & 0xff00ffffffffffffLL);
+ else
+ reg = ((reg & 0x0000ff0000000000LL) >> (24 - bits))
+ | (reg & 0xffff00ffffffffffLL);
+ /* Now we can place the bytes correctly. */
+ *value = __bswap_64(reg);
+ }
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = (c[0] << (8 + lastbyte_bits)) | (c[1] << lastbyte_bits)
- | (c[2] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = (c[0] << (8 + lastbyte_bits)) | (c[1] << lastbyte_bits)
+ | (c[2] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -403,38 +403,38 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[3], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- if ((offset % 8) == 0)
- /* If little endian and the least significant byte is 8 bits aligned,
- then we can handle the information byte by byte as we read. */
- *value = (c[3] << (16 + lastbyte_bits)) | (c[2] << 16) | (c[1] << 8)
- | c[0];
- else
- {
- /* We have to shift to fill the least significant byte to get
- the right bits in the same bytes. */
- uint64_t reg;
- reg = ((uint64_t) c[0] << (56 + offset % 8))
- | ((uint64_t) c[1] << (48 + offset % 8))
- | ((uint64_t) c[2] << (40 + offset % 8))
- | ((uint64_t) c[3] << (32 + offset % 8));
- /* The bits in the most-significant-byte-to-be is aligned to left,
- shift it towards right! */
- if (bits <= 24)
- reg = ((reg & 0x0000ff0000000000LL) >> (24 - bits))
- | (reg & 0xffff00ffffffffffLL);
- else
- reg = ((reg & 0x000000ff00000000LL) >> (32 - bits))
- | (reg & 0xffffff00ffffffffLL);
- /* Now we can place the bytes correctly. */
- *value = __bswap_64(reg);
- }
+ if ((offset % 8) == 0)
+ /* If little endian and the least significant byte is 8 bits aligned,
+ then we can handle the information byte by byte as we read. */
+ *value = (c[3] << (16 + lastbyte_bits)) | (c[2] << 16) | (c[1] << 8)
+ | c[0];
+ else
+ {
+ /* We have to shift to fill the least significant byte to get
+ the right bits in the same bytes. */
+ uint64_t reg;
+ reg = ((uint64_t) c[0] << (56 + offset % 8))
+ | ((uint64_t) c[1] << (48 + offset % 8))
+ | ((uint64_t) c[2] << (40 + offset % 8))
+ | ((uint64_t) c[3] << (32 + offset % 8));
+ /* The bits in the most-significant-byte-to-be is aligned to left,
+ shift it towards right! */
+ if (bits <= 24)
+ reg = ((reg & 0x0000ff0000000000LL) >> (24 - bits))
+ | (reg & 0xffff00ffffffffffLL);
+ else
+ reg = ((reg & 0x000000ff00000000LL) >> (32 - bits))
+ | (reg & 0xffffff00ffffffffLL);
+ /* Now we can place the bytes correctly. */
+ *value = __bswap_64(reg);
+ }
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = (c[0] << (16 + lastbyte_bits)) | (c[1] << (8 + lastbyte_bits))
- | (c[2] << lastbyte_bits) | (c[3] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = (c[0] << (16 + lastbyte_bits)) | (c[1] << (8 + lastbyte_bits))
+ | (c[2] << lastbyte_bits) | (c[3] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -442,42 +442,42 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[4], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- if ((offset % 8) == 0)
- /* If little endian and the least significant byte is 8 bits aligned,
- then we can handle the information byte by byte as we read. */
- *value = ((uint64_t) c[4] << (24 + lastbyte_bits))
- | ((uint64_t) c[3] << 24) | (c[2] << 16)
- | (c[1] << 8) | c[0];
- else
- {
- /* We have to shift to fill the least significant byte to get
- the right bits in the same bytes. */
- uint64_t reg;
- reg = ((uint64_t) c[0] << (56 + offset % 8))
- | ((uint64_t) c[1] << (48 + offset % 8))
- | ((uint64_t) c[2] << (40 + offset % 8))
- | ((uint64_t) c[3] << (32 + offset % 8))
- | ((uint64_t) c[4] << (24 + offset % 8));
- /* The bits in the most-significant-byte-to-be is aligned to left,
- shift it towards right! */
- if (bits <= 32)
- reg = ((reg & 0x000000ff00000000LL) >> (32 - bits))
- | (reg & 0xffffff00ffffffffLL);
- else
- reg = ((reg & 0x00000000ff000000LL) >> (40 - bits))
- | (reg & 0xffffffff00ffffffLL);
- /* Now we can place the bytes correctly. */
- *value = __bswap_64(reg);
- }
+ if ((offset % 8) == 0)
+ /* If little endian and the least significant byte is 8 bits aligned,
+ then we can handle the information byte by byte as we read. */
+ *value = ((uint64_t) c[4] << (24 + lastbyte_bits))
+ | ((uint64_t) c[3] << 24) | (c[2] << 16)
+ | (c[1] << 8) | c[0];
+ else
+ {
+ /* We have to shift to fill the least significant byte to get
+ the right bits in the same bytes. */
+ uint64_t reg;
+ reg = ((uint64_t) c[0] << (56 + offset % 8))
+ | ((uint64_t) c[1] << (48 + offset % 8))
+ | ((uint64_t) c[2] << (40 + offset % 8))
+ | ((uint64_t) c[3] << (32 + offset % 8))
+ | ((uint64_t) c[4] << (24 + offset % 8));
+ /* The bits in the most-significant-byte-to-be is aligned to left,
+ shift it towards right! */
+ if (bits <= 32)
+ reg = ((reg & 0x000000ff00000000LL) >> (32 - bits))
+ | (reg & 0xffffff00ffffffffLL);
+ else
+ reg = ((reg & 0x00000000ff000000LL) >> (40 - bits))
+ | (reg & 0xffffffff00ffffffLL);
+ /* Now we can place the bytes correctly. */
+ *value = __bswap_64(reg);
+ }
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = ((uint64_t) c[0] << (24 + lastbyte_bits))
- | ((uint64_t) c[1] << (16 + lastbyte_bits))
- | (c[2] << (8 + lastbyte_bits)) | (c[3] << lastbyte_bits)
- | (c[4] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = ((uint64_t) c[0] << (24 + lastbyte_bits))
+ | ((uint64_t) c[1] << (16 + lastbyte_bits))
+ | (c[2] << (8 + lastbyte_bits)) | (c[3] << lastbyte_bits)
+ | (c[4] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -485,44 +485,44 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[5], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- if ((offset % 8) == 0)
- /* If little endian and the least significant byte is 8 bits aligned,
- then we can handle the information byte by byte as we read. */
- *value = ((uint64_t) c[5] << (32 + lastbyte_bits))
- | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
- | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- {
- /* We have to shift to fill the least significant byte to get
- the right bits in the same bytes. */
- uint64_t reg;
- reg = ((uint64_t) c[0] << (56 + offset % 8))
- | ((uint64_t) c[1] << (48 + offset % 8))
- | ((uint64_t) c[2] << (40 + offset % 8))
- | ((uint64_t) c[3] << (32 + offset % 8))
- | ((uint64_t) c[4] << (24 + offset % 8))
- | (c[5] << (16 + offset % 8));
- /* The bits in the most-significant-byte-to-be is aligned to left,
- shift it towards right! */
- if (bits <= 40)
- reg = ((reg & 0x00000000ff000000LL) >> (40 - bits))
- | (reg & 0xffffffff00ffffffLL);
- else
- reg = ((reg & 0x0000000000ff0000LL) >> (48 - bits))
- | (reg & 0xffffffffff00ffffLL);
- /* Now we can place the bytes correctly. */
- *value = __bswap_64(reg);
- }
+ if ((offset % 8) == 0)
+ /* If little endian and the least significant byte is 8 bits aligned,
+ then we can handle the information byte by byte as we read. */
+ *value = ((uint64_t) c[5] << (32 + lastbyte_bits))
+ | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
+ | (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ {
+ /* We have to shift to fill the least significant byte to get
+ the right bits in the same bytes. */
+ uint64_t reg;
+ reg = ((uint64_t) c[0] << (56 + offset % 8))
+ | ((uint64_t) c[1] << (48 + offset % 8))
+ | ((uint64_t) c[2] << (40 + offset % 8))
+ | ((uint64_t) c[3] << (32 + offset % 8))
+ | ((uint64_t) c[4] << (24 + offset % 8))
+ | (c[5] << (16 + offset % 8));
+ /* The bits in the most-significant-byte-to-be is aligned to left,
+ shift it towards right! */
+ if (bits <= 40)
+ reg = ((reg & 0x00000000ff000000LL) >> (40 - bits))
+ | (reg & 0xffffffff00ffffffLL);
+ else
+ reg = ((reg & 0x0000000000ff0000LL) >> (48 - bits))
+ | (reg & 0xffffffffff00ffffLL);
+ /* Now we can place the bytes correctly. */
+ *value = __bswap_64(reg);
+ }
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = ((uint64_t) c[0] << (32 + lastbyte_bits))
- | ((uint64_t) c[1] << (24 + lastbyte_bits))
- | ((uint64_t) c[2] << (16 + lastbyte_bits))
- | (c[3] << (8 + lastbyte_bits))
- | (c[4] << lastbyte_bits) | (c[5] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = ((uint64_t) c[0] << (32 + lastbyte_bits))
+ | ((uint64_t) c[1] << (24 + lastbyte_bits))
+ | ((uint64_t) c[2] << (16 + lastbyte_bits))
+ | (c[3] << (8 + lastbyte_bits))
+ | (c[4] << lastbyte_bits) | (c[5] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -530,47 +530,47 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[6], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- if ((offset % 8) == 0)
- /* If little endian and the least significant byte is 8 bits aligned,
- then we can handle the information byte by byte as we read. */
- *value = ((uint64_t) c[6] << (40 + lastbyte_bits))
- | ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
- | ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8)
- | c[0];
- else
- {
- /* We have to shift to fill the least significant byte to get
- the right bits in the same bytes. */
- uint64_t reg;
- reg = ((uint64_t) c[0] << (56 + offset % 8))
- | ((uint64_t) c[1] << (48 + offset % 8))
- | ((uint64_t) c[2] << (40 + offset % 8))
- | ((uint64_t) c[3] << (32 + offset % 8))
- | ((uint64_t) c[4] << (24 + offset % 8))
- | (c[5] << (16 + offset % 8))
- | (c[6] << (8 + offset % 8));
- /* The bits in the most-significant-byte-to-be is aligned to left,
- shift it towards right! */
- if (bits <= 48)
- reg = ((reg & 0x0000000000ff0000LL) >> (48 - bits))
- | (reg & 0xffffffffff00ffffLL);
- else
- reg = ((reg & 0x000000000000ff00LL) >> (56 - bits))
- | (reg & 0xffffffffffff00ffLL);
- /* Now we can place the bytes correctly. */
- *value = __bswap_64(reg);
- }
+ if ((offset % 8) == 0)
+ /* If little endian and the least significant byte is 8 bits aligned,
+ then we can handle the information byte by byte as we read. */
+ *value = ((uint64_t) c[6] << (40 + lastbyte_bits))
+ | ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
+ | ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8)
+ | c[0];
+ else
+ {
+ /* We have to shift to fill the least significant byte to get
+ the right bits in the same bytes. */
+ uint64_t reg;
+ reg = ((uint64_t) c[0] << (56 + offset % 8))
+ | ((uint64_t) c[1] << (48 + offset % 8))
+ | ((uint64_t) c[2] << (40 + offset % 8))
+ | ((uint64_t) c[3] << (32 + offset % 8))
+ | ((uint64_t) c[4] << (24 + offset % 8))
+ | (c[5] << (16 + offset % 8))
+ | (c[6] << (8 + offset % 8));
+ /* The bits in the most-significant-byte-to-be is aligned to left,
+ shift it towards right! */
+ if (bits <= 48)
+ reg = ((reg & 0x0000000000ff0000LL) >> (48 - bits))
+ | (reg & 0xffffffffff00ffffLL);
+ else
+ reg = ((reg & 0x000000000000ff00LL) >> (56 - bits))
+ | (reg & 0xffffffffffff00ffLL);
+ /* Now we can place the bytes correctly. */
+ *value = __bswap_64(reg);
+ }
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = ((uint64_t) c[0] << (40 + lastbyte_bits))
- | ((uint64_t) c[1] << (32 + lastbyte_bits))
- | ((uint64_t) c[2] << (24 + lastbyte_bits))
- | ((uint64_t) c[3] << (16 + lastbyte_bits))
- | (c[4] << (8 + lastbyte_bits)) | (c[5] << lastbyte_bits)
- | (c[6] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = ((uint64_t) c[0] << (40 + lastbyte_bits))
+ | ((uint64_t) c[1] << (32 + lastbyte_bits))
+ | ((uint64_t) c[2] << (24 + lastbyte_bits))
+ | ((uint64_t) c[3] << (16 + lastbyte_bits))
+ | (c[4] << (8 + lastbyte_bits)) | (c[5] << lastbyte_bits)
+ | (c[6] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -578,48 +578,48 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[7], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- if ((offset % 8) == 0)
- /* If little endian and the least significant byte is 8 bits aligned,
- then we can handle the information byte by byte as we read. */
- *value = ((uint64_t) c[7] << (48 + lastbyte_bits))
- | ((uint64_t) c[6] << 48) | ((uint64_t) c[5] << 40)
- | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
- | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- {
- /* We have to shift to fill the least significant byte to get
- the right bits in the same bytes. */
- uint64_t reg;
- reg = ((uint64_t) c[0] << (56 + offset % 8))
- | ((uint64_t) c[1] << (48 + offset % 8))
- | ((uint64_t) c[2] << (40 + offset % 8))
- | ((uint64_t) c[3] << (32 + offset % 8))
- | ((uint64_t) c[4] << (24 + offset % 8))
- | (c[5] << (16 + offset % 8))
- | (c[6] << (8 + offset % 8)) | (c[7] << offset % 8);
- /* The bits in the most-significant-byte-to-be is aligned to left,
- shift it towards right! */
- if (bits <= 56)
- reg = ((reg & 0x000000000000ff00LL) >> (56 - bits))
- | (reg & 0xffffffffffff00ffLL);
- else
- reg = ((reg & 0x00000000000000ffLL) >> (64 - bits))
- | (reg & 0xffffffffffffff00LL);
- /* Now we can place the bytes correctly. */
- *value = __bswap_64(reg);
- }
+ if ((offset % 8) == 0)
+ /* If little endian and the least significant byte is 8 bits aligned,
+ then we can handle the information byte by byte as we read. */
+ *value = ((uint64_t) c[7] << (48 + lastbyte_bits))
+ | ((uint64_t) c[6] << 48) | ((uint64_t) c[5] << 40)
+ | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
+ | (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ {
+ /* We have to shift to fill the least significant byte to get
+ the right bits in the same bytes. */
+ uint64_t reg;
+ reg = ((uint64_t) c[0] << (56 + offset % 8))
+ | ((uint64_t) c[1] << (48 + offset % 8))
+ | ((uint64_t) c[2] << (40 + offset % 8))
+ | ((uint64_t) c[3] << (32 + offset % 8))
+ | ((uint64_t) c[4] << (24 + offset % 8))
+ | (c[5] << (16 + offset % 8))
+ | (c[6] << (8 + offset % 8)) | (c[7] << offset % 8);
+ /* The bits in the most-significant-byte-to-be is aligned to left,
+ shift it towards right! */
+ if (bits <= 56)
+ reg = ((reg & 0x000000000000ff00LL) >> (56 - bits))
+ | (reg & 0xffffffffffff00ffLL);
+ else
+ reg = ((reg & 0x00000000000000ffLL) >> (64 - bits))
+ | (reg & 0xffffffffffffff00LL);
+ /* Now we can place the bytes correctly. */
+ *value = __bswap_64(reg);
+ }
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = ((uint64_t) c[0] << (48 + lastbyte_bits))
- | ((uint64_t) c[1] << (40 + lastbyte_bits))
- | ((uint64_t) c[2] << (32 + lastbyte_bits))
- | ((uint64_t) c[3] << (24 + lastbyte_bits))
- | ((uint64_t) c[4] << (16 + lastbyte_bits))
- | (c[5] << (8 + lastbyte_bits))
- | (c[6] << lastbyte_bits) | (c[7] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = ((uint64_t) c[0] << (48 + lastbyte_bits))
+ | ((uint64_t) c[1] << (40 + lastbyte_bits))
+ | ((uint64_t) c[2] << (32 + lastbyte_bits))
+ | ((uint64_t) c[3] << (24 + lastbyte_bits))
+ | ((uint64_t) c[4] << (16 + lastbyte_bits))
+ | (c[5] << (8 + lastbyte_bits))
+ | (c[6] << lastbyte_bits) | (c[7] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -627,36 +627,36 @@ ios_read_int_common (ios io, ios_off offset, int flags,
IOS_CHAR_GET_MSB(&c[8], lastbyte_bits);
if (endian == IOS_ENDIAN_LSB)
{
- /* We have to shift to fill the least significant byte to get
- the right bits in the same bytes. */
- uint64_t reg;
- reg = ((uint64_t) c[0] << (56 + offset % 8))
- | ((uint64_t) c[1] << (48 + offset % 8))
- | ((uint64_t) c[2] << (40 + offset % 8))
- | ((uint64_t) c[3] << (32 + offset % 8))
- | ((uint64_t) c[4] << (24 + offset % 8))
- | (c[5] << (16 + offset % 8))
- | (c[6] << (8 + offset % 8)) | (c[7] << offset % 8)
- | (c[8] >> firstbyte_bits);
- /* The bits in the most-significant-byte-to-be is aligned to left,
- shift it towards right! */
- reg = ((reg & 0x00000000000000ffLL) >> (64 - bits))
- | (reg & 0xffffffffffffff00LL);
- /* Now we can place the bytes correctly. */
- *value = __bswap_64(reg);
+ /* We have to shift to fill the least significant byte to get
+ the right bits in the same bytes. */
+ uint64_t reg;
+ reg = ((uint64_t) c[0] << (56 + offset % 8))
+ | ((uint64_t) c[1] << (48 + offset % 8))
+ | ((uint64_t) c[2] << (40 + offset % 8))
+ | ((uint64_t) c[3] << (32 + offset % 8))
+ | ((uint64_t) c[4] << (24 + offset % 8))
+ | (c[5] << (16 + offset % 8))
+ | (c[6] << (8 + offset % 8)) | (c[7] << offset % 8)
+ | (c[8] >> firstbyte_bits);
+ /* The bits in the most-significant-byte-to-be is aligned to left,
+ shift it towards right! */
+ reg = ((reg & 0x00000000000000ffLL) >> (64 - bits))
+ | (reg & 0xffffffffffffff00LL);
+ /* Now we can place the bytes correctly. */
+ *value = __bswap_64(reg);
}
else
{
- /* We should shift to fill the least significant byte
- which is the last 8 bits. */
- *value = ((uint64_t) c[0] << (56 + lastbyte_bits))
- | ((uint64_t) c[1] << (48 + lastbyte_bits))
- | ((uint64_t) c[2] << (40 + lastbyte_bits))
- | ((uint64_t) c[3] << (32 + lastbyte_bits))
- | ((uint64_t) c[4] << (24 + lastbyte_bits))
- | ((uint64_t) c[5] << (16 + lastbyte_bits))
- | (c[6] << (8 + lastbyte_bits)) | (c[7] << lastbyte_bits)
- | (c[8] >> (8 - lastbyte_bits));
+ /* We should shift to fill the least significant byte
+ which is the last 8 bits. */
+ *value = ((uint64_t) c[0] << (56 + lastbyte_bits))
+ | ((uint64_t) c[1] << (48 + lastbyte_bits))
+ | ((uint64_t) c[2] << (40 + lastbyte_bits))
+ | ((uint64_t) c[3] << (32 + lastbyte_bits))
+ | ((uint64_t) c[4] << (24 + lastbyte_bits))
+ | ((uint64_t) c[5] << (16 + lastbyte_bits))
+ | (c[6] << (8 + lastbyte_bits)) | (c[7] << lastbyte_bits)
+ | (c[8] >> (8 - lastbyte_bits));
}
return IOS_OK;
@@ -680,107 +680,107 @@ ios_read_int (ios io, ios_off offset, int flags,
{
uint8_t c[8];
if (io->dev_if->pread (io->dev, c, bits / 8, offset / 8) == IOD_EOF)
- return IOS_EIOFF;
+ return IOS_EIOFF;
switch (bits) {
case 8:
- {
- *value = (int8_t) c[0];
- return IOS_OK;
- }
+ {
+ *value = (int8_t) c[0];
+ return IOS_OK;
+ }
case 16:
- {
- if (endian == IOS_ENDIAN_LSB)
- *value = (int16_t) (c[1] << 8) | c[0];
- else
- *value = (int16_t) (c[0] << 8) | c[1];
- return IOS_OK;
- }
+ {
+ if (endian == IOS_ENDIAN_LSB)
+ *value = (int16_t) (c[1] << 8) | c[0];
+ else
+ *value = (int16_t) (c[0] << 8) | c[1];
+ return IOS_OK;
+ }
case 24:
- {
- if (endian == IOS_ENDIAN_LSB)
- *value = (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = (c[0] << 16) | (c[1] << 8) | c[2];
- *value <<= 40;
- *value >>= 40;
- return IOS_OK;
- }
+ {
+ if (endian == IOS_ENDIAN_LSB)
+ *value = (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ *value = (c[0] << 16) | (c[1] << 8) | c[2];
+ *value <<= 40;
+ *value >>= 40;
+ return IOS_OK;
+ }
case 32:
{
- if (endian == IOS_ENDIAN_LSB)
- *value = (int32_t) (c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = (int32_t) (c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
- return IOS_OK;
- }
+ if (endian == IOS_ENDIAN_LSB)
+ *value = (int32_t) (c[3] << 24) | (c[2] << 16) | (c[1] << 8) |
c[0];
+ else
+ *value = (int32_t) (c[0] << 24) | (c[1] << 16) | (c[2] << 8) |
c[3];
+ return IOS_OK;
+ }
case 40:
{
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
- | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = ((uint64_t) c[0] << 32) | ((uint64_t) c[1] << 24)
- | (c[2] << 16) | (c[3] << 8) | c[4];
- *value <<= 24;
- *value >>= 24;
- return IOS_OK;
- }
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
+ | (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ *value = ((uint64_t) c[0] << 32) | ((uint64_t) c[1] << 24)
+ | (c[2] << 16) | (c[3] << 8) | c[4];
+ *value <<= 24;
+ *value >>= 24;
+ return IOS_OK;
+ }
case 48:
- {
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
- | ((uint64_t) c[3] << 24) | (c[2] << 16)
- | (c[1] << 8) | c[0];
- else
- *value = ((uint64_t) c[0] << 40) | ((uint64_t) c[1] << 32)
- | ((uint64_t) c[2] << 24) | (c[3] << 16)
- | (c[4] << 8) | c[5];
- *value <<= 16;
- *value >>= 16;
- return IOS_OK;
- }
+ {
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
+ | ((uint64_t) c[3] << 24) | (c[2] << 16)
+ | (c[1] << 8) | c[0];
+ else
+ *value = ((uint64_t) c[0] << 40) | ((uint64_t) c[1] << 32)
+ | ((uint64_t) c[2] << 24) | (c[3] << 16)
+ | (c[4] << 8) | c[5];
+ *value <<= 16;
+ *value >>= 16;
+ return IOS_OK;
+ }
case 56:
- {
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[6] << 48) | ((uint64_t) c[5] << 40)
- | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
- | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = ((uint64_t) c[0] << 48) | ((uint64_t) c[1] << 40)
- | ((uint64_t) c[2] << 32) | ((uint64_t) c[3] << 24)
- | (c[4] << 16) | (c[5] << 8) | c[6];
- *value <<= 8;
- *value >>= 8;
- return IOS_OK;
- }
+ {
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[6] << 48) | ((uint64_t) c[5] << 40)
+ | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
+ | (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ *value = ((uint64_t) c[0] << 48) | ((uint64_t) c[1] << 40)
+ | ((uint64_t) c[2] << 32) | ((uint64_t) c[3] << 24)
+ | (c[4] << 16) | (c[5] << 8) | c[6];
+ *value <<= 8;
+ *value >>= 8;
+ return IOS_OK;
+ }
case 64:
- {
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[7] << 56) | ((uint64_t) c[6] << 48)
- | ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
- | ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8)
- | c[0];
- else
- *value = ((uint64_t) c[0] << 56) | ((uint64_t) c[1] << 48)
- | ((uint64_t) c[2] << 40) | ((uint64_t) c[3] << 32)
- | ((uint64_t) c[4] << 24) | (c[5] << 16) | (c[6] << 8)
- | c[7];
- return IOS_OK;
- }
+ {
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[7] << 56) | ((uint64_t) c[6] << 48)
+ | ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
+ | ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8)
+ | c[0];
+ else
+ *value = ((uint64_t) c[0] << 56) | ((uint64_t) c[1] << 48)
+ | ((uint64_t) c[2] << 40) | ((uint64_t) c[3] << 32)
+ | ((uint64_t) c[4] << 24) | (c[5] << 16) | (c[6] << 8)
+ | c[7];
+ return IOS_OK;
+ }
}
}
/* Fall into the case for the unaligned and the sizes other than 8x. */
int ret_val = ios_read_int_common(io, offset, flags, bits, endian,
- (uint64_t *) value);
+ (uint64_t *) value);
if (ret_val == IOS_OK)
{
*value <<= 64 - bits;
@@ -804,77 +804,77 @@ ios_read_uint (ios io, ios_off offset, int flags,
{
uint8_t c[8];
if (io->dev_if->pread (io->dev, c, bits / 8, offset / 8) == IOD_EOF)
- return IOS_EIOFF;
+ return IOS_EIOFF;
switch (bits) {
case 8:
- *value = c[0];
- return IOS_OK;
+ *value = c[0];
+ return IOS_OK;
case 16:
- if (endian == IOS_ENDIAN_LSB)
- *value = (c[1] << 8) | c[0];
- else
- *value = (c[0] << 8) | c[1];
- return IOS_OK;
+ if (endian == IOS_ENDIAN_LSB)
+ *value = (c[1] << 8) | c[0];
+ else
+ *value = (c[0] << 8) | c[1];
+ return IOS_OK;
case 24:
- if (endian == IOS_ENDIAN_LSB)
- *value = (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = (c[0] << 16) | (c[1] << 8) | c[2];
- return IOS_OK;
+ if (endian == IOS_ENDIAN_LSB)
+ *value = (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ *value = (c[0] << 16) | (c[1] << 8) | c[2];
+ return IOS_OK;
case 32:
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = ((uint64_t) c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
- return IOS_OK;
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ *value = ((uint64_t) c[0] << 24) | (c[1] << 16) | (c[2] << 8) | c[3];
+ return IOS_OK;
case 40:
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
- | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = ((uint64_t) c[0] << 32) | ((uint64_t) c[1] << 24)
- | (c[2] << 16) | (c[3] << 8) | c[4];
- return IOS_OK;
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
+ | (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ *value = ((uint64_t) c[0] << 32) | ((uint64_t) c[1] << 24)
+ | (c[2] << 16) | (c[3] << 8) | c[4];
+ return IOS_OK;
case 48:
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
- | ((uint64_t) c[3] << 24) | (c[2] << 16)
- | (c[1] << 8) | c[0];
- else
- *value = ((uint64_t) c[0] << 40) | ((uint64_t) c[1] << 32)
- | ((uint64_t) c[2] << 24) | (c[3] << 16)
- | (c[4] << 8) | c[5];
- return IOS_OK;
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
+ | ((uint64_t) c[3] << 24) | (c[2] << 16)
+ | (c[1] << 8) | c[0];
+ else
+ *value = ((uint64_t) c[0] << 40) | ((uint64_t) c[1] << 32)
+ | ((uint64_t) c[2] << 24) | (c[3] << 16)
+ | (c[4] << 8) | c[5];
+ return IOS_OK;
case 56:
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[6] << 48) | ((uint64_t) c[5] << 40)
- | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
- | (c[2] << 16) | (c[1] << 8) | c[0];
- else
- *value = ((uint64_t) c[0] << 48) | ((uint64_t) c[1] << 40)
- | ((uint64_t) c[2] << 32) | ((uint64_t) c[3] << 24)
- | (c[4] << 16) | (c[5] << 8) | c[6];
- return IOS_OK;
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[6] << 48) | ((uint64_t) c[5] << 40)
+ | ((uint64_t) c[4] << 32) | ((uint64_t) c[3] << 24)
+ | (c[2] << 16) | (c[1] << 8) | c[0];
+ else
+ *value = ((uint64_t) c[0] << 48) | ((uint64_t) c[1] << 40)
+ | ((uint64_t) c[2] << 32) | ((uint64_t) c[3] << 24)
+ | (c[4] << 16) | (c[5] << 8) | c[6];
+ return IOS_OK;
case 64:
- if (endian == IOS_ENDIAN_LSB)
- *value = ((uint64_t) c[7] << 56) | ((uint64_t) c[6] << 48)
- | ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
- | ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8)
- | c[0];
- else
- *value = ((uint64_t) c[0] << 56) | ((uint64_t) c[1] << 48)
- | ((uint64_t) c[2] << 40) | ((uint64_t) c[3] << 32)
- | ((uint64_t) c[4] << 24) | (c[5] << 16) | (c[6] << 8)
- | c[7];
- return IOS_OK;
+ if (endian == IOS_ENDIAN_LSB)
+ *value = ((uint64_t) c[7] << 56) | ((uint64_t) c[6] << 48)
+ | ((uint64_t) c[5] << 40) | ((uint64_t) c[4] << 32)
+ | ((uint64_t) c[3] << 24) | (c[2] << 16) | (c[1] << 8)
+ | c[0];
+ else
+ *value = ((uint64_t) c[0] << 56) | ((uint64_t) c[1] << 48)
+ | ((uint64_t) c[2] << 40) | ((uint64_t) c[3] << 32)
+ | ((uint64_t) c[4] << 24) | (c[5] << 16) | (c[6] << 8)
+ | c[7];
+ return IOS_OK;
}
}
@@ -903,7 +903,7 @@ ios_read_string (ios io, ios_off offset, int flags, char
**value)
str = xrealloc (str, i + 128 * sizeof (char));
if (io->dev_if->pread (io->dev, &str[i], 1,
- offset / 8 + i) == IOD_EOF)
+ offset / 8 + i) == IOD_EOF)
return IOS_EIOFF;
}
while (str[i++] != '\0');
@@ -940,9 +940,9 @@ ios_read_string (ios io, ios_off offset, int flags, char
**value)
static inline int
ios_write_int_fast (ios io, ios_off offset, int flags,
- int bits,
- enum ios_endian endian,
- uint64_t value)
+ int bits,
+ enum ios_endian endian,
+ uint64_t value)
{
uint8_t c[8];
@@ -954,135 +954,135 @@ ios_write_int_fast (ios io, ios_off offset, int flags,
case 16:
if (endian == IOS_ENDIAN_LSB)
- {
- c[0] = value;
- c[1] = value >> 8;
- }
+ {
+ c[0] = value;
+ c[1] = value >> 8;
+ }
else
- {
- c[0] = value >> 8;
- c[1] = value;
- }
+ {
+ c[0] = value >> 8;
+ c[1] = value;
+ }
break;
case 24:
if (endian == IOS_ENDIAN_LSB)
- {
- c[0] = value;
- c[1] = value >> 8;
- c[2] = value >> 16;
- }
+ {
+ c[0] = value;
+ c[1] = value >> 8;
+ c[2] = value >> 16;
+ }
else
- {
- c[0] = value >> 16;
- c[1] = value >> 8;
- c[2] = value;
- }
+ {
+ c[0] = value >> 16;
+ c[1] = value >> 8;
+ c[2] = value;
+ }
break;
case 32:
if (endian == IOS_ENDIAN_LSB)
- {
- c[0] = value;
- c[1] = value >> 8;
- c[2] = value >> 16;
- c[3] = value >> 24;
- }
+ {
+ c[0] = value;
+ c[1] = value >> 8;
+ c[2] = value >> 16;
+ c[3] = value >> 24;
+ }
else
- {
- c[0] = value >> 24;
- c[1] = value >> 16;
- c[2] = value >> 8;
- c[3] = value;
- }
+ {
+ c[0] = value >> 24;
+ c[1] = value >> 16;
+ c[2] = value >> 8;
+ c[3] = value;
+ }
break;
case 40:
if (endian == IOS_ENDIAN_LSB)
- {
- c[0] = value;
- c[1] = value >> 8;
- c[2] = value >> 16;
- c[3] = value >> 24;
- c[4] = value >> 32;
- }
+ {
+ c[0] = value;
+ c[1] = value >> 8;
+ c[2] = value >> 16;
+ c[3] = value >> 24;
+ c[4] = value >> 32;
+ }
else
- {
- c[0] = value >> 32;
- c[1] = value >> 24;
- c[2] = value >> 16;
- c[3] = value >> 8;
- c[4] = value;
- }
+ {
+ c[0] = value >> 32;
+ c[1] = value >> 24;
+ c[2] = value >> 16;
+ c[3] = value >> 8;
+ c[4] = value;
+ }
break;
case 48:
if (endian == IOS_ENDIAN_LSB)
- {
- c[0] = value;
- c[1] = value >> 8;
- c[2] = value >> 16;
- c[3] = value >> 24;
- c[4] = value >> 32;
- c[5] = value >> 40;
- }
+ {
+ c[0] = value;
+ c[1] = value >> 8;
+ c[2] = value >> 16;
+ c[3] = value >> 24;
+ c[4] = value >> 32;
+ c[5] = value >> 40;
+ }
else
- {
- c[0] = value >> 40;
- c[1] = value >> 32;
- c[2] = value >> 24;
- c[3] = value >> 16;
- c[4] = value >> 8;
- c[5] = value;
- }
+ {
+ c[0] = value >> 40;
+ c[1] = value >> 32;
+ c[2] = value >> 24;
+ c[3] = value >> 16;
+ c[4] = value >> 8;
+ c[5] = value;
+ }
break;
case 56:
if (endian == IOS_ENDIAN_LSB)
- {
- c[0] = value;
- c[1] = value >> 8;
- c[2] = value >> 16;
- c[3] = value >> 24;
- c[4] = value >> 32;
- c[5] = value >> 40;
- c[6] = value >> 48;
- }
+ {
+ c[0] = value;
+ c[1] = value >> 8;
+ c[2] = value >> 16;
+ c[3] = value >> 24;
+ c[4] = value >> 32;
+ c[5] = value >> 40;
+ c[6] = value >> 48;
+ }
else
- {
- c[0] = value >> 48;
- c[1] = value >> 40;
- c[2] = value >> 32;
- c[3] = value >> 24;
- c[4] = value >> 16;
- c[5] = value >> 8;
- c[6] = value;
- }
+ {
+ c[0] = value >> 48;
+ c[1] = value >> 40;
+ c[2] = value >> 32;
+ c[3] = value >> 24;
+ c[4] = value >> 16;
+ c[5] = value >> 8;
+ c[6] = value;
+ }
break;
case 64:
if (endian == IOS_ENDIAN_LSB)
- {
- c[0] = value;
- c[1] = value >> 8;
- c[2] = value >> 16;
- c[3] = value >> 24;
- c[4] = value >> 32;
- c[5] = value >> 40;
- c[6] = value >> 48;
- c[7] = value >> 56;
- }
+ {
+ c[0] = value;
+ c[1] = value >> 8;
+ c[2] = value >> 16;
+ c[3] = value >> 24;
+ c[4] = value >> 32;
+ c[5] = value >> 40;
+ c[6] = value >> 48;
+ c[7] = value >> 56;
+ }
else
- {
- c[0] = value >> 56;
- c[1] = value >> 48;
- c[2] = value >> 40;
- c[3] = value >> 32;
- c[4] = value >> 24;
- c[5] = value >> 16;
- c[6] = value >> 8;
- c[7] = value;
- }
+ {
+ c[0] = value >> 56;
+ c[1] = value >> 48;
+ c[2] = value >> 40;
+ c[3] = value >> 32;
+ c[4] = value >> 24;
+ c[5] = value >> 16;
+ c[6] = value >> 8;
+ c[7] = value;
+ }
break;
default:
@@ -1097,9 +1097,9 @@ ios_write_int_fast (ios io, ios_off offset, int flags,
static inline int
ios_write_int_common (ios io, ios_off offset, int flags,
- int bits,
- enum ios_endian endian,
- uint64_t value)
+ int bits,
+ enum ios_endian endian,
+ uint64_t value)
{
/* 64 bits might span at most 9 bytes. */
uint8_t c[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -1141,11 +1141,11 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB && bits > 8)
{
- /* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
- value = ((value & 0xff) << (bits % 8))
- | (value & 0xff00) >> 8;
+ /* Convert to the little endian format. For example a 12-bit-long
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
+ value = ((value & 0xff) << (bits % 8))
+ | (value & 0xff00) >> 8;
}
c[0] |= value >> lastbyte_bits;
c[1] |= (value << (8 - lastbyte_bits)) & 0xff;
@@ -1163,15 +1163,15 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB)
{
/* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
if (bits <= 16)
- value = ((value & 0xff) << (bits % 8))
- | (value & 0xff00) >> 8;
+ value = ((value & 0xff) << (bits % 8))
+ | (value & 0xff00) >> 8;
else
- value = ((value & 0xff) << (8 + bits % 8))
- | (value & 0xff00) >> (8 - bits % 8)
- | (value & 0xff0000) >> 16;
+ value = ((value & 0xff) << (8 + bits % 8))
+ | (value & 0xff00) >> (8 - bits % 8)
+ | (value & 0xff0000) >> 16;
}
c[0] |= value >> (8 + lastbyte_bits);
c[1] = (value >> lastbyte_bits) & 0xff;
@@ -1190,17 +1190,17 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB)
{
/* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
if (bits <= 24)
- value = ((value & 0xff) << (8 + bits % 8))
- | (value & 0xff00) >> (8 - bits % 8)
- | (value & 0xff0000) >> 16;
+ value = ((value & 0xff) << (8 + bits % 8))
+ | (value & 0xff00) >> (8 - bits % 8)
+ | (value & 0xff0000) >> 16;
else
- value = ((value & 0xff) << (16 + bits % 8))
- | (value & 0xff00) << (bits % 8)
- | (value & 0xff0000) >> (16 - bits % 8)
- | (value & 0xff000000) >> 24;
+ value = ((value & 0xff) << (16 + bits % 8))
+ | (value & 0xff00) << (bits % 8)
+ | (value & 0xff0000) >> (16 - bits % 8)
+ | (value & 0xff000000) >> 24;
}
c[0] |= value >> (16 + lastbyte_bits);
c[1] = (value >> (8 + lastbyte_bits)) & 0xff;
@@ -1220,19 +1220,19 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB)
{
/* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
if (bits <= 32)
- value = ((value & 0xff) << (16 + bits % 8))
- | (value & 0xff00) << (bits % 8)
- | (value & 0xff0000) >> (16 - bits % 8)
- | (value & 0xff000000) >> 24;
+ value = ((value & 0xff) << (16 + bits % 8))
+ | (value & 0xff00) << (bits % 8)
+ | (value & 0xff0000) >> (16 - bits % 8)
+ | (value & 0xff000000) >> 24;
else
- value = ((value & 0xff) << (24 + bits % 8))
- | (value & 0xff00) << (8 + bits % 8)
- | (value & 0xff0000) >> (8 - bits % 8)
- | (value & 0xff000000) >> (24 - bits % 8)
- | (value & 0xff00000000) >> 32;
+ value = ((value & 0xff) << (24 + bits % 8))
+ | (value & 0xff00) << (8 + bits % 8)
+ | (value & 0xff0000) >> (8 - bits % 8)
+ | (value & 0xff000000) >> (24 - bits % 8)
+ | (value & 0xff00000000) >> 32;
}
c[0] |= value >> (24 + lastbyte_bits);
c[1] = (value >> (16 + lastbyte_bits)) & 0xff;
@@ -1253,21 +1253,21 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB)
{
/* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
if (bits <= 40)
- value = ((value & 0xff) << (24 + bits % 8))
- | (value & 0xff00) << (8 + bits % 8)
- | (value & 0xff0000) >> (8 - bits % 8)
- | (value & 0xff000000) >> (24 - bits % 8)
- | (value & 0xff00000000) >> 32;
+ value = ((value & 0xff) << (24 + bits % 8))
+ | (value & 0xff00) << (8 + bits % 8)
+ | (value & 0xff0000) >> (8 - bits % 8)
+ | (value & 0xff000000) >> (24 - bits % 8)
+ | (value & 0xff00000000) >> 32;
else
- value = ((value & 0xff) << (32 + bits % 8))
- | (value & 0xff00) << (16 + bits % 8)
- | (value & 0xff0000) << (bits % 8)
- | (value & 0xff000000) >> (16 - bits % 8)
- | (value & 0xff00000000) >> (32 - bits % 8)
- | (value & 0xff0000000000) >> 40;
+ value = ((value & 0xff) << (32 + bits % 8))
+ | (value & 0xff00) << (16 + bits % 8)
+ | (value & 0xff0000) << (bits % 8)
+ | (value & 0xff000000) >> (16 - bits % 8)
+ | (value & 0xff00000000) >> (32 - bits % 8)
+ | (value & 0xff0000000000) >> 40;
}
c[0] |= value >> (32 + lastbyte_bits);
c[1] = (value >> (24 + lastbyte_bits)) & 0xff;
@@ -1289,23 +1289,23 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB)
{
/* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
if (bits <= 48)
- value = ((value & 0xff) << (32 + bits % 8))
- | (value & 0xff00) << (16 + bits % 8)
- | (value & 0xff0000) << (bits % 8)
- | (value & 0xff000000) >> (16 - bits % 8)
- | (value & 0xff00000000) >> (32 - bits % 8)
- | (value & 0xff0000000000) >> 40;
+ value = ((value & 0xff) << (32 + bits % 8))
+ | (value & 0xff00) << (16 + bits % 8)
+ | (value & 0xff0000) << (bits % 8)
+ | (value & 0xff000000) >> (16 - bits % 8)
+ | (value & 0xff00000000) >> (32 - bits % 8)
+ | (value & 0xff0000000000) >> 40;
else
- value = ((value & 0xff) << (40 + bits % 8))
- | (value & 0xff00) << (24 + bits % 8)
- | (value & 0xff0000) << (8 + bits % 8)
- | (value & 0xff000000) >> (8 - bits % 8)
- | (value & 0xff00000000) >> (24 - bits % 8)
- | (value & 0xff0000000000) >> (40 - bits % 8)
- | (value & 0xff000000000000) >> 48;
+ value = ((value & 0xff) << (40 + bits % 8))
+ | (value & 0xff00) << (24 + bits % 8)
+ | (value & 0xff0000) << (8 + bits % 8)
+ | (value & 0xff000000) >> (8 - bits % 8)
+ | (value & 0xff00000000) >> (24 - bits % 8)
+ | (value & 0xff0000000000) >> (40 - bits % 8)
+ | (value & 0xff000000000000) >> 48;
}
c[0] |= value >> (40 + lastbyte_bits);
c[1] = (value >> (32 + lastbyte_bits)) & 0xff;
@@ -1328,25 +1328,25 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB)
{
/* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
if (bits <= 56)
- value = ((value & 0xff) << (40 + bits % 8))
- | (value & 0xff00) << (24 + bits % 8)
- | (value & 0xff0000) << (8 + bits % 8)
- | (value & 0xff000000) >> (8 - bits % 8)
- | (value & 0xff00000000) >> (24 - bits % 8)
- | (value & 0xff0000000000) >> (40 - bits % 8)
- | (value & 0xff000000000000) >> 48;
+ value = ((value & 0xff) << (40 + bits % 8))
+ | (value & 0xff00) << (24 + bits % 8)
+ | (value & 0xff0000) << (8 + bits % 8)
+ | (value & 0xff000000) >> (8 - bits % 8)
+ | (value & 0xff00000000) >> (24 - bits % 8)
+ | (value & 0xff0000000000) >> (40 - bits % 8)
+ | (value & 0xff000000000000) >> 48;
else
- value = ((value & 0xff) << (48 + bits % 8))
- | (value & 0xff00) << (32 + bits % 8)
- | (value & 0xff0000) << (16 + bits % 8)
- | (value & 0xff000000) << (bits % 8)
- | (value & 0xff00000000) >> (16 - bits % 8)
- | (value & 0xff0000000000) >> (32 - bits % 8)
- | (value & 0xff000000000000) >> (48 - bits % 8)
- | (value & 0xff00000000000000) >> 56;
+ value = ((value & 0xff) << (48 + bits % 8))
+ | (value & 0xff00) << (32 + bits % 8)
+ | (value & 0xff0000) << (16 + bits % 8)
+ | (value & 0xff000000) << (bits % 8)
+ | (value & 0xff00000000) >> (16 - bits % 8)
+ | (value & 0xff0000000000) >> (32 - bits % 8)
+ | (value & 0xff000000000000) >> (48 - bits % 8)
+ | (value & 0xff00000000000000) >> 56;
}
c[0] |= value >> (48 + lastbyte_bits);
c[1] = (value >> (40 + lastbyte_bits)) & 0xff;
@@ -1370,16 +1370,16 @@ ios_write_int_common (ios io, ios_off offset, int flags,
if (endian == IOS_ENDIAN_LSB)
{
/* Convert to the little endian format. For example a 12-bit-long
- number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
- with leading 0s. */
+ number's bits get reordered as 7-6-5-4-3-2-1-0-11-10-9-8
+ with leading 0s. */
value = ((value & 0xff) << (48 + bits % 8))
- | (value & 0xff00) << (32 + bits % 8)
- | (value & 0xff0000) << (16 + bits % 8)
- | (value & 0xff000000) << (bits % 8)
- | (value & 0xff00000000) >> (16 - bits % 8)
- | (value & 0xff0000000000) >> (32 - bits % 8)
- | (value & 0xff000000000000) >> (48 - bits % 8)
- | (value & 0xff00000000000000) >> 56;
+ | (value & 0xff00) << (32 + bits % 8)
+ | (value & 0xff0000) << (16 + bits % 8)
+ | (value & 0xff000000) << (bits % 8)
+ | (value & 0xff00000000) >> (16 - bits % 8)
+ | (value & 0xff0000000000) >> (32 - bits % 8)
+ | (value & 0xff000000000000) >> (48 - bits % 8)
+ | (value & 0xff00000000000000) >> 56;
}
c[0] |= value >> (56 + lastbyte_bits);
c[1] = (value >> (48 + lastbyte_bits)) & 0xff;
@@ -1455,7 +1455,7 @@ ios_write_string (ios io, ios_off offset, int flags,
do
{
if (io->dev_if->pwrite (io->dev, p, 1,
- offset / 8 + p - value) == IOD_EOF)
+ offset / 8 + p - value) == IOD_EOF)
return IOS_EIOFF;
}
while (*(p++) != '\0');
diff --git a/src/pk-cmd.c b/src/pk-cmd.c
index e46cd7de..d5a0d1cf 100644
--- a/src/pk-cmd.c
+++ b/src/pk-cmd.c
@@ -296,10 +296,10 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char
*prefix)
while (isalnum (*p) || *p == '_' || *p == '-' || *p == ':')
{
if (i >= MAX_CMD_NAME - 1)
- {
- pk_printf (_("%s: command not found.\n"), cmd_name);
- return 0;
- }
+ {
+ pk_printf (_("%s: command not found.\n"), cmd_name);
+ return 0;
+ }
cmd_name[i++] = *(p++);
}
@@ -478,8 +478,8 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char
*prefix)
}
case 'f':
{
- wordexp_t exp_result;
- exp_result.we_wordv = 0;
+ wordexp_t exp_result;
+ exp_result.we_wordv = 0;
if (p[0] == '\0')
GOTO_USAGE();
@@ -488,10 +488,10 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char
*prefix)
case 0: /* Successful. */
break;
default:
- if (exp_result.we_wordv)
- wordfree (&exp_result);
+ if (exp_result.we_wordv)
+ wordfree (&exp_result);
GOTO_USAGE();
- break;
+ break;
}
if (exp_result.we_wordc != 1)
{
@@ -502,11 +502,11 @@ pk_cmd_exec_1 (char *str, struct pk_trie *cmds_trie, char
*prefix)
char *filename = strdup (exp_result.we_wordv[0]);
wordfree (&exp_result);
- argv[argc].type = PK_CMD_ARG_STR;
- argv[argc].val.str = filename;
- match = 1;
+ argv[argc].type = PK_CMD_ARG_STR;
+ argv[argc].val.str = filename;
+ match = 1;
- p += strlen (p);
+ p += strlen (p);
break;
}
default:
@@ -705,14 +705,14 @@ pk_cmd_exec_script (const char *filename)
ssize_t n = getline (&line, &line_len, fd);
if (n == -1)
- {
- if (errno != 0)
- perror (filename);
- break;
- }
+ {
+ if (errno != 0)
+ perror (filename);
+ break;
+ }
if (line[n - 1] == '\n')
- line[n - 1] = '\0';
+ line[n - 1] = '\0';
/* If the line is empty, or it starts with '#', or it contains
just blank characters, just ignore it. */
@@ -799,7 +799,7 @@ pk_cmd_get_next_match (int *idx, const char *x, size_t len)
{
const struct pk_cmd **c = dot_cmds + *idx;
if (*c == &null_cmd)
- break;
+ break;
/* don't forget the null terminator of name */
const size_t name_len = strlen ((*c)->name);
@@ -807,11 +807,11 @@ pk_cmd_get_next_match (int *idx, const char *x, size_t
len)
name[0] = '.';
strncpy (name+1, (*c)->name, name_len + 1);
if (0 != strncmp (name, x, len))
- {
- free (name);
- (*idx)++;
- continue;
- }
+ {
+ free (name);
+ (*idx)++;
+ continue;
+ }
return name;
}
return NULL;
@@ -827,12 +827,12 @@ pk_cmd_find (const char *cmdname)
{
const struct pk_cmd **c;
for (c = dot_cmds; *c != &null_cmd; ++c)
- {
- /* Check if the command name matches.
- +1 to skip the leading '.' */
- if (STREQ ((*c)->name, cmdname + 1))
- return *c;
- }
+ {
+ /* Check if the command name matches.
+ +1 to skip the leading '.' */
+ if (STREQ ((*c)->name, cmdname + 1))
+ return *c;
+ }
}
return NULL;
}
diff --git a/src/pk-editor.c b/src/pk-editor.c
index 2f96536a..61677fb3 100644
--- a/src/pk-editor.c
+++ b/src/pk-editor.c
@@ -53,7 +53,7 @@ pk_cmd_editor (int argc, struct pk_cmd_arg argv[], uint64_t
uflags)
{
editor = find_in_path ("sensible-editor");
if (STREQ (editor, "sensible-editor"))
- editor = NULL;
+ editor = NULL;
}
if (!editor)
{
diff --git a/src/pk-info.c b/src/pk-info.c
index b2261d9e..53bc4bff 100644
--- a/src/pk-info.c
+++ b/src/pk-info.c
@@ -49,13 +49,13 @@ info_completion_function (const char *x, int state)
const struct pk_cmd **c = info_cmds + idx;
if (*c == &null_cmd)
- break;
+ break;
if (0 != strncmp ((*c)->name, x, len))
- {
- idx++;
- continue;
- }
+ {
+ idx++;
+ continue;
+ }
return strdup ((*c)->name);
}
diff --git a/src/pk-ios.c b/src/pk-ios.c
index bb81527d..08e3d637 100644
--- a/src/pk-ios.c
+++ b/src/pk-ios.c
@@ -51,17 +51,17 @@ ios_completion_function (const char *x, int state)
while (1)
{
if (ios_end (io))
- break;
+ break;
char buf[16];
snprintf (buf, 16, "#%d", ios_get_id (io));
int match = strncmp (buf, x, len);
if (match != 0)
- {
- io = ios_next (io);
- continue;
- }
+ {
+ io = ios_next (io);
+ continue;
+ }
return strdup (buf);
}
@@ -192,7 +192,7 @@ print_info_ios (ios io, void *data)
pk_printf ("%s#%d\t%s\t",
io == ios_cur () ? "* " : " ",
ios_get_id (io),
- mode);
+ mode);
#if HAVE_HSERVER
{
diff --git a/src/pk-misc.c b/src/pk-misc.c
index b764f815..cc6ebac1 100644
--- a/src/pk-misc.c
+++ b/src/pk-misc.c
@@ -77,29 +77,29 @@ pk_cmd_doc (int argc, struct pk_cmd_arg argv[], uint64_t
uflags)
const char *ip = find_in_path (info_prog_name);
if (STREQ (ip, info_prog_name))
{
- pk_term_class ("error");
- pk_puts ("error: ");
- pk_term_end_class ("error");
- pk_puts ("the \"info\" program is not installed.\n");
- return 0;
+ pk_term_class ("error");
+ pk_puts ("error: ");
+ pk_term_end_class ("error");
+ pk_puts ("the \"info\" program is not installed.\n");
+ return 0;
}
do
{
- size = bytes + 1;
- cmd = xrealloc (cmd, size);
- bytes = snprintf (cmd, size, "info -f \"%s/poke.info\"",
- poke_infodir);
+ size = bytes + 1;
+ cmd = xrealloc (cmd, size);
+ bytes = snprintf (cmd, size, "info -f \"%s/poke.info\"",
+ poke_infodir);
}
while (bytes >= size);
if (argv[0].type == PK_CMD_ARG_STR)
{
- const char *node = argv[0].val.str;
- cmd = xrealloc (cmd, bytes + 7 + strlen (node));
- strcat (cmd, " -n \"");
- strcat (cmd, node);
- strcat (cmd, "\"");
+ const char *node = argv[0].val.str;
+ cmd = xrealloc (cmd, bytes + 7 + strlen (node));
+ strcat (cmd, " -n \"");
+ strcat (cmd, node);
+ strcat (cmd, "\"");
}
/* Open the documentation at the requested page. */
@@ -167,19 +167,19 @@ doc_completion_function (const char *x, int state)
snprintf (nlfile, 256, "%s/nodelist", poke_datadir);
FILE *fp = fopen (nlfile, "r");
if (fp == NULL)
- return NULL;
+ return NULL;
char *lineptr = NULL;
size_t size = 0;
while (!feof (fp))
- {
- int x = getline (&lineptr, &size, fp);
- if (x != -1)
- {
- nodelist = xrealloc (nodelist, ++n_nodes * sizeof (*nodelist));
- lineptr [strlen (lineptr) - 1] = '\0';
- nodelist[n_nodes - 1] = strdup (lineptr);
- }
- }
+ {
+ int x = getline (&lineptr, &size, fp);
+ if (x != -1)
+ {
+ nodelist = xrealloc (nodelist, ++n_nodes * sizeof (*nodelist));
+ lineptr [strlen (lineptr) - 1] = '\0';
+ nodelist[n_nodes - 1] = strdup (lineptr);
+ }
+ }
fclose (fp);
free (lineptr);
nodelist = xrealloc (nodelist, ++n_nodes * sizeof (*nodelist));
@@ -197,14 +197,14 @@ doc_completion_function (const char *x, int state)
{
const char *name = nodelist[idx];
if (name == NULL)
- break;
+ break;
int match = strncmp (name, x, len);
if (match != 0)
- {
- idx++;
- continue;
- }
+ {
+ idx++;
+ continue;
+ }
return strdup (name);
}
diff --git a/src/pk-repl.c b/src/pk-repl.c
index a5c8458b..cd895172 100644
--- a/src/pk-repl.c
+++ b/src/pk-repl.c
@@ -124,9 +124,9 @@ poke_completion_function (const char *x, int state)
else
{
if (pkl_env_iter_end (env, &iter))
- idx++;
+ idx++;
else
- pkl_env_iter_next (env, &iter);
+ pkl_env_iter_next (env, &iter);
}
size_t len = strlen (x);
@@ -160,15 +160,15 @@ char * doc_completion_function (const char *x, int state);
a space. */
static void
space_substitute_display_matches (char **matches, int num_matches,
- int max_length)
+ int max_length)
{
for (int i = 0; i < num_matches + 1; ++i)
{
for (char *m = matches[i]; *m; ++m)
- {
- if (*m == SPACE_SUBSTITUTE)
- *m = ' ';
- }
+ {
+ if (*m == SPACE_SUBSTITUTE)
+ *m = ' ';
+ }
}
rl_display_match_list (matches, num_matches, max_length);
@@ -215,12 +215,12 @@ poke_getc (FILE *stream)
if (rl_completion_entry_function == poke_completion_function)
{
if (cmd)
- {
- if (cmd->completer)
- rl_completion_entry_function = cmd->completer;
- else
- rl_completion_entry_function = null_completion_function;
- }
+ {
+ if (cmd->completer)
+ rl_completion_entry_function = cmd->completer;
+ else
+ rl_completion_entry_function = null_completion_function;
+ }
}
free (line_to_point);
@@ -236,7 +236,7 @@ poke_getc (FILE *stream)
rl_redisplay_function = space_substitute_redisplay;
if (c == ' ')
- c = SPACE_SUBSTITUTE;
+ c = SPACE_SUBSTITUTE;
}
else
{
@@ -307,7 +307,7 @@ escape_metacharacters (char *text, int match_type, char *qp)
{
char c = *p++;
if (c == ' ')
- *r++ = '\\';
+ *r++ = '\\';
*r++ = c;
}
*r = '\0';
@@ -336,12 +336,12 @@ pk_repl (void)
if (homedir != NULL)
{
poke_history = xmalloc (strlen (homedir)
- + strlen ("/.poke_history") + 1);
+ + strlen ("/.poke_history") + 1);
strcpy (poke_history, homedir);
strcat (poke_history, "/.poke_history");
if (access (poke_history, R_OK) == 0)
- read_history (poke_history);
+ read_history (poke_history);
}
#endif
rl_getc_function = poke_getc;
@@ -367,13 +367,13 @@ pk_repl (void)
}
if (rl_completion_entry_function == doc_completion_function)
- {
- for (char *s = line; *s; ++s)
- {
- if (*s == SPACE_SUBSTITUTE)
- *s = ' ';
- }
- }
+ {
+ for (char *s = line; *s; ++s)
+ {
+ if (*s == SPACE_SUBSTITUTE)
+ *s = ' ';
+ }
+ }
/* Ignore empty lines. */
if (*line == '\0')
diff --git a/src/pk-set.c b/src/pk-set.c
index 515da8d1..db3e47bd 100644
--- a/src/pk-set.c
+++ b/src/pk-set.c
@@ -493,18 +493,18 @@ set_completion_function (const char *x, int state)
const struct pk_cmd **c = set_cmds + idx;
if (*c == &null_cmd)
- break;
+ break;
char *name = xmalloc (strlen ( (*c)->name) + 1);
strcpy (name, (*c)->name);
int match = strncmp (name, x, len);
if (match != 0)
- {
- free (name);
- idx++;
- continue;
- }
+ {
+ free (name);
+ idx++;
+ continue;
+ }
return name;
}
diff --git a/src/pk-utils.c b/src/pk-utils.c
index 303d1fb4..0d659004 100644
--- a/src/pk-utils.c
+++ b/src/pk-utils.c
@@ -51,7 +51,7 @@ pk_file_readable (const char *filename)
{
char *why = strerror (errno);
snprintf (errmsg, 4096, _("%s: file cannot be read: %s\n"),
- filename, why);
+ filename, why);
return errmsg;
}
diff --git a/src/pkl-env.c b/src/pkl-env.c
index 999c3b82..6404135c 100644
--- a/src/pkl-env.c
+++ b/src/pkl-env.c
@@ -271,7 +271,7 @@ pkl_env_iter_begin (pkl_env env, struct pkl_ast_node_iter
*iter)
{
iter->bucket++;
if (iter->bucket >= HASH_TABLE_SIZE)
- break;
+ break;
iter->node = env->hash_table[iter->bucket];
}
}
@@ -286,7 +286,7 @@ pkl_env_iter_next (pkl_env env, struct pkl_ast_node_iter
*iter)
{
iter->bucket++;
if (iter->bucket >= HASH_TABLE_SIZE)
- break;
+ break;
iter->node = env->hash_table[iter->bucket];
}
}
@@ -308,8 +308,8 @@ pkl_env_map_decls (pkl_env env,
pkl_env_iter_next (env, &iter))
{
if ((what == PKL_AST_DECL_KIND_ANY
- || what == PKL_AST_DECL_KIND (iter.node)))
- cb (iter.node, data);
+ || what == PKL_AST_DECL_KIND (iter.node)))
+ cb (iter.node, data);
}
}
@@ -358,21 +358,21 @@ pkl_env_dup_toplevel (pkl_env env)
The returned value must be freed by the caller. */
char *
pkl_env_get_next_matching_decl (pkl_env env, struct pkl_ast_node_iter *iter,
- const char *name, size_t len)
+ const char *name, size_t len)
{
/* "Normal" commands. */
for (;;)
{
if (pkl_env_iter_end (env, iter))
- break;
+ break;
pkl_ast_node decl_name = PKL_AST_DECL_NAME (iter->node);
const char *cmdname = PKL_AST_IDENTIFIER_POINTER (decl_name);
if (0 != strncmp (cmdname, name, len))
- {
- pkl_env_iter_next (env, iter);
+ {
+ pkl_env_iter_next (env, iter);
continue;
- }
+ }
return strdup (cmdname);
}
return NULL;
diff --git a/src/pkl-env.h b/src/pkl-env.h
index c3ff0f4e..066a2274 100644
--- a/src/pkl-env.h
+++ b/src/pkl-env.h
@@ -147,7 +147,7 @@ void pkl_env_iter_next (pkl_env env, struct
pkl_ast_node_iter *iter);
bool pkl_env_iter_end (pkl_env env, const struct pkl_ast_node_iter *iter);
char *pkl_env_get_next_matching_decl (pkl_env env,
- struct pkl_ast_node_iter *iter,
- const char *name, size_t len);
+ struct pkl_ast_node_iter *iter,
+ const char *name, size_t len);
#endif /* !PKL_ENV_H */
diff --git a/src/pkl-gen.pks b/src/pkl-gen.pks
index 0aa547bb..4c1f06be 100644
--- a/src/pkl-gen.pks
+++ b/src/pkl-gen.pks
@@ -95,9 +95,9 @@
;; If there is an EBOUND, check it.
;; Else, if there is a SBOUND, check it.
;; Else, iterate (unbounded).
- pushvar $ebound ; OFF ATYPE NELEM
+ pushvar $ebound ; OFF ATYPE NELEM
bn .loop_on_sbound
- pushvar $eidx ; OFF ATYPE NELEM I
+ pushvar $eidx ; OFF ATYPE NELEM I
gtlu ; OFF ATYPE NELEM I (NELEM>I)
nip2 ; OFF ATYPE (NELEM>I)
ba .end_loop_on
@@ -266,7 +266,7 @@
;; Initialize the element index to 0UL, and put it
;; in a local.
push ulong<64>0 ; BOFF 0UL
- regvar $eidx ; BOFF
+ regvar $eidx ; BOFF
;; Get the number of elements in NVAL, and put it in a local.
pushvar $nval ; BOFF NVAL
sel ; BOFF NVAL NELEM
@@ -641,14 +641,14 @@
.c PKL_GEN_PAYLOAD->endian = PKL_AST_STRUCT_TYPE_FIELD_ENDIAN (field);
.c PKL_PASS_SUBPASS (PKL_AST_STRUCT_TYPE_FIELD_TYPE (field));
.c PKL_GEN_PAYLOAD->endian = endian; }
- ; BOFF VAL
+ ; BOFF VAL
dup ; BOFF VAL VAL
regvar $val ; BOFF VAL
.c if (PKL_AST_STRUCT_TYPE_FIELD_NAME (field) == NULL)
push null
.c else
.c PKL_PASS_SUBPASS (PKL_AST_STRUCT_TYPE_FIELD_NAME (field));
- ; BOFF VAL STR
+ ; BOFF VAL STR
swap ; BOFF STR VAL
;; If this is an optional field, evaluate the optcond. If
;; it is false, then do not add this field to the struct.
@@ -792,7 +792,7 @@
raise
.c }
.union_fields_done:
- drop ; ...[EBOFF ENAME EVAL]
+ drop ; ...[EBOFF ENAME EVAL]
;; Ok, at this point all the struct field triplets are
;; in the stack.
;; Iterate over the methods of the struct type.
--
2.26.0
- [PATCH] Fix indentation to spaces only,
Tim Rühsen <=