Fix: A potential bug of null pointer dereference
[binutils-gdb.git] / libsframe / sframe-impl.h
blob06b4a89da6745effb49ddd5e8d6978709dd63f46
1 /* Implementation header.
3 Copyright (C) 2022-2023 Free Software Foundation, Inc.
5 This file is part of libsframe.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef _SFRAME_IMPL_H
21 #define _SFRAME_IMPL_H
23 #include "sframe-api.h"
25 #ifdef __cplusplus
26 extern "C"
28 #endif
30 #include <assert.h>
31 #define sframe_assert(expr) (assert (expr))
33 struct sframe_decoder_ctx
35 /* SFrame header. */
36 sframe_header sfd_header;
37 /* SFrame function desc entries table. */
38 sframe_func_desc_entry *sfd_funcdesc;
39 /* SFrame FRE table. */
40 char *sfd_fres;
41 /* Number of bytes needed for SFrame FREs. */
42 int sfd_fre_nbytes;
43 /* Reference to the internally malloc'd buffer, if any, for endian flipping
44 the original input buffer before decoding. */
45 void *sfd_buf;
48 typedef struct sf_fde_tbl sf_fde_tbl;
49 typedef struct sf_fre_tbl sf_fre_tbl;
51 struct sframe_encoder_ctx
53 /* SFrame header. */
54 sframe_header sfe_header;
55 /* SFrame function desc entries table. */
56 sf_fde_tbl *sfe_funcdesc;
57 /* SFrame FRE table. */
58 sf_fre_tbl *sfe_fres;
59 /* Number of bytes needed for SFrame FREs. */
60 uint32_t sfe_fre_nbytes;
61 /* SFrame output data buffer. */
62 char *sfe_data;
63 /* Size of the SFrame output data buffer. */
64 size_t sfe_data_size;
67 #ifdef __cplusplus
69 #endif
71 #endif /* _SFRAME_IMPL_H */