Skip to content

Commit

Permalink
strtab: make internal structures private
Browse files Browse the repository at this point in the history
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
kvanhees committed Jul 21, 2023
1 parent aabbba8 commit c1a199f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
19 changes: 19 additions & 0 deletions libdtrace/dt_strtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@
#include <dt_string.h>
#include <dt_impl.h>

typedef struct dt_strhash {
const char *str_data; /* pointer to actual string data */
ulong_t str_buf; /* index of string data buffer */
size_t str_off; /* offset in bytes of this string */
size_t str_len; /* length in bytes of this string */
struct dt_strhash *str_next; /* next string in hash chain */
} dt_strhash_t;

struct dt_strtab {
dt_strhash_t **str_hash; /* array of hash buckets */
ulong_t str_hashsz; /* size of hash bucket array */
char **str_bufs; /* array of buffer pointers */
char *str_ptr; /* pointer to current buffer location */
ulong_t str_nbufs; /* size of buffer pointer array */
size_t str_bufsz; /* size of individual buffer */
ulong_t str_nstrs; /* total number of strings in strtab */
size_t str_size; /* total size of strings in bytes */
};

static int
dt_strtab_grow(dt_strtab_t *sp)
{
Expand Down
19 changes: 1 addition & 18 deletions libdtrace/dt_strtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,7 @@
extern "C" {
#endif

typedef struct dt_strhash {
const char *str_data; /* pointer to actual string data */
ulong_t str_buf; /* index of string data buffer */
size_t str_off; /* offset in bytes of this string */
size_t str_len; /* length in bytes of this string */
struct dt_strhash *str_next; /* next string in hash chain */
} dt_strhash_t;

typedef struct dt_strtab {
dt_strhash_t **str_hash; /* array of hash buckets */
ulong_t str_hashsz; /* size of hash bucket array */
char **str_bufs; /* array of buffer pointers */
char *str_ptr; /* pointer to current buffer location */
ulong_t str_nbufs; /* size of buffer pointer array */
size_t str_bufsz; /* size of individual buffer */
ulong_t str_nstrs; /* total number of strings in strtab */
size_t str_size; /* total size of strings in bytes */
} dt_strtab_t;
typedef struct dt_strtab dt_strtab_t;

typedef ssize_t dt_strtab_write_f(const char *, size_t, size_t, void *);

Expand Down

0 comments on commit c1a199f

Please sign in to comment.