xen/decompress: Drop bool_t and use bool instead

In particular, the libxg wrapper for unxz.c uses char for bool_t which is a
major antipattern.  Luckily the code doesn't suffer from truncated values.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Andrew Cooper committed 2023-06-21 19:08:22 +01:00
1 parent ef8d841229
commit 5c84f1f636
7 files changed
+20 -21

No files matched your search

@@ -11,7 +11,6 @@
// TODO
#define XZ_DEC_X86
typedef char bool_t;
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
+1 -1
View File
@@ -166,7 +166,7 @@ int __init unxz(unsigned char *in, unsigned int in_size,
struct xz_buf b;
struct xz_dec *s;
enum xz_ret ret;
bool_t must_free_in = false;
bool must_free_in = false;
xz_crc32_init();
+3 -3
View File
@@ -35,7 +35,7 @@ struct xz_dec_bcj {
enum xz_ret ret;
/* True if we are operating in single-call mode. */
bool_t single_call;
bool single_call;
/*
* Absolute position relative to the beginning of the uncompressed
@@ -87,7 +87,7 @@ static inline int __init bcj_x86_test_msbyte(uint8_t b)
static size_t __init bcj_x86(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
{
static const bool_t mask_to_allowed_status[8]
static const bool mask_to_allowed_status[8]
= { true, true, true, false, true, false, false, false };
static const uint8_t mask_to_bit_num[8] = { 0, 1, 2, 2, 3, 3, 3, 3 };
@@ -524,7 +524,7 @@ XZ_EXTERN enum xz_ret __init xz_dec_bcj_run(struct xz_dec_bcj *s,
return s->ret;
}
XZ_EXTERN struct xz_dec_bcj *__init xz_dec_bcj_create(bool_t single_call)
XZ_EXTERN struct xz_dec_bcj *__init xz_dec_bcj_create(bool single_call)
{
struct xz_dec_bcj *s = malloc(sizeof(*s));
if (s != NULL)
+10 -10
View File
@@ -241,13 +241,13 @@ struct lzma2_dec {
* True if dictionary reset is needed. This is false before
* the first chunk (LZMA or uncompressed).
*/
bool_t need_dict_reset;
bool need_dict_reset;
/*
* True if new LZMA properties are needed. This is false
* before the first LZMA chunk.
*/
bool_t need_props;
bool need_props;
};
struct xz_dec_lzma2 {
@@ -306,7 +306,7 @@ static void __init dict_limit(struct dictionary *dict, size_t out_max)
}
/* Return true if at least one byte can be written into the dictionary. */
static inline bool_t __init dict_has_space(const struct dictionary *dict)
static inline bool __init dict_has_space(const struct dictionary *dict)
{
return dict->pos < dict->limit;
}
@@ -343,7 +343,7 @@ static inline void __init dict_put(struct dictionary *dict, uint8_t byte)
* invalid, false is returned. On success, true is returned and *len is
* updated to indicate how many bytes were left to be repeated.
*/
static bool_t __init dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist)
static bool __init dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist)
{
size_t back;
uint32_t left;
@@ -463,7 +463,7 @@ static void __init rc_reset(struct rc_dec *rc)
* Read the first five initial bytes into rc->code if they haven't been
* read already. (Yes, the first byte gets completely ignored.)
*/
static bool_t __init rc_read_init(struct rc_dec *rc, struct xz_buf *b)
static bool __init rc_read_init(struct rc_dec *rc, struct xz_buf *b)
{
while (rc->init_bytes_left > 0) {
if (b->in_pos == b->in_size)
@@ -477,7 +477,7 @@ static bool_t __init rc_read_init(struct rc_dec *rc, struct xz_buf *b)
}
/* Return true if there may not be enough input for the next decoding loop. */
static inline bool_t __init rc_limit_exceeded(const struct rc_dec *rc)
static inline bool __init rc_limit_exceeded(const struct rc_dec *rc)
{
return rc->in_pos > rc->in_limit;
}
@@ -486,7 +486,7 @@ static inline bool_t __init rc_limit_exceeded(const struct rc_dec *rc)
* Return true if it is possible (from point of view of range decoder) that
* we have reached the end of the LZMA chunk.
*/
static inline bool_t __init rc_is_finished(const struct rc_dec *rc)
static inline bool __init rc_is_finished(const struct rc_dec *rc)
{
return rc->code == 0;
}
@@ -736,7 +736,7 @@ static void __init lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
}
/* LZMA decoder core */
static bool_t __init lzma_main(struct xz_dec_lzma2 *s)
static bool __init lzma_main(struct xz_dec_lzma2 *s)
{
uint32_t pos_state;
@@ -814,7 +814,7 @@ static void __init lzma_reset(struct xz_dec_lzma2 *s)
* from the decoded lp and pb values. On success, the LZMA decoder state is
* reset and true is returned.
*/
static bool_t __init lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
static bool __init lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
{
if (props > (4 * 5 + 4) * 9 + 8)
return false;
@@ -861,7 +861,7 @@ static bool_t __init lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
* function. We decode a few bytes from the temporary buffer so that we can
* continue decoding from the caller-supplied input buffer again.
*/
static bool_t __init lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
static bool __init lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
{
size_t in_avail;
uint32_t tmp;
+4 -4
View File
@@ -55,7 +55,7 @@ struct xz_dec {
* True if the next call to xz_dec_run() is allowed to return
* XZ_BUF_ERROR.
*/
bool_t allow_buf_error;
bool allow_buf_error;
/* Information stored in Block Header */
struct {
@@ -132,7 +132,7 @@ struct xz_dec {
#ifdef XZ_DEC_BCJ
struct xz_dec_bcj *bcj;
bool_t bcj_active;
bool bcj_active;
#endif
};
@@ -154,7 +154,7 @@ static const uint8_t check_sizes[16] = {
* to copy into s->temp.buf. Return true once s->temp.pos has reached
* s->temp.size.
*/
static bool_t __init fill_temp(struct xz_dec *s, struct xz_buf *b)
static bool __init fill_temp(struct xz_dec *s, struct xz_buf *b)
{
size_t copy_size = min_t(size_t,
b->in_size - b->in_pos, s->temp.size - s->temp.pos);
@@ -367,7 +367,7 @@ static enum xz_ret __init crc32_validate(struct xz_dec *s, struct xz_buf *b)
* Skip over the Check field when the Check ID is not supported.
* Returns true once the whole Check field has been skipped over.
*/
static bool_t __init check_skip(struct xz_dec *s, struct xz_buf *b)
static bool __init check_skip(struct xz_dec *s, struct xz_buf *b)
{
while (s->pos < check_sizes[s->check_type]) {
if (b->in_pos == b->in_size)
+1 -1
View File
@@ -90,7 +90,7 @@ static inline void __init lzma_state_short_rep(enum lzma_state *state)
}
/* Test if the previous symbol was a literal. */
static inline bool_t __init lzma_state_is_literal(enum lzma_state state)
static inline bool __init lzma_state_is_literal(enum lzma_state state)
{
return state < LIT_STATES;
}
+1 -1
View File
@@ -237,7 +237,7 @@ XZ_EXTERN void xz_dec_lzma2_end(struct xz_dec_lzma2 *s);
* Allocate memory for BCJ decoders. xz_dec_bcj_reset() must be used before
* calling xz_dec_bcj_run().
*/
XZ_EXTERN struct xz_dec_bcj *xz_dec_bcj_create(bool_t single_call);
XZ_EXTERN struct xz_dec_bcj *xz_dec_bcj_create(bool single_call);
/*
* Decode the Filter ID of a BCJ filter. This implementation doesn't
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.