nasm/include/zdata.h
H. Peter Anvin (Intel) ad529b5790 zdata: move compressed data handling out of the macro machinery
Move the handling of compressed data out of macro-handling-specific
code.

- This cleans up the code by separating out unrelated code.
- This makes it much easier to e.g. change from zlib to some other
  compression format (which could even be host-specific), and
  abstracts the representation of a compressed data unit.
- Allows future reuse for other purposes.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2026-06-21 15:43:38 -07:00

30 lines
781 B
C

/* SPDX-License-Identifier: BSD-2-Clause */
/* Copyright 1996-2025 The NASM Authors - All Rights Reserved */
/*
* zdata.h - compressed data functions
*/
#ifndef NASM_ZDATA_H
#define NASM_ZDATA_H 1
struct zdata {
unsigned int dsize, zsize;
const void *zdata;
};
/*
* Always uncompress zdata; if the data is uncompressed, return a copy of
* it in a new buffer.
*/
void *uncompress_zdata(const struct zdata *);
/*
* Uncompress zdata only if it actually compressed; otherwise return
* a pointer to the stored uncompressed data. *buf is set to the buffer
* address if it was nasm_malloc'd, otherwise NULL (this pointer can be
* safely passed to nasm_free() or nasm_delete().)
*/
const void *get_zdata(const struct zdata *, void **buf);
#endif /* NASM_ZDATA_H */