#include <unistd.h>
#include <zlib.h>
+#ifndef EOVERFLOW
+#define EOVERFLOW ERANGE
+#endif
+
#ifndef roundup
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#endif
nfp->ctf_link_variable_filter = fp->ctf_link_variable_filter;
nfp->ctf_link_variable_filter_arg = fp->ctf_link_variable_filter_arg;
nfp->ctf_link_flags = fp->ctf_link_flags;
+ nfp->ctf_dedup_atoms = fp->ctf_dedup_atoms;
+ nfp->ctf_dedup_atoms_alloc = fp->ctf_dedup_atoms_alloc;
+ memcpy (&nfp->ctf_dedup, &fp->ctf_dedup, sizeof (fp->ctf_dedup));
nfp->ctf_snapshot_lu = fp->ctf_snapshots;
fp->ctf_link_in_cu_mapping = NULL;
fp->ctf_link_out_cu_mapping = NULL;
fp->ctf_link_type_mapping = NULL;
+ fp->ctf_dedup_atoms = NULL;
+ fp->ctf_dedup_atoms_alloc = NULL;
fp->ctf_parent_unreffed = 1;
fp->ctf_dvhash = NULL;
memset (&fp->ctf_dvdefs, 0, sizeof (ctf_list_t));
memset (fp->ctf_lookups, 0, sizeof (fp->ctf_lookups));
+ memset (&fp->ctf_dedup, 0, sizeof (fp->ctf_dedup));
fp->ctf_structs.ctn_writable = NULL;
fp->ctf_unions.ctn_writable = NULL;
fp->ctf_enums.ctn_writable = NULL;
ctf_dtd_insert (ctf_file_t *fp, ctf_dtdef_t *dtd, int flag, int kind)
{
const char *name;
- if (ctf_dynhash_insert (fp->ctf_dthash, (void *) dtd->dtd_type, dtd) < 0)
+ if (ctf_dynhash_insert (fp->ctf_dthash, (void *) (uintptr_t) dtd->dtd_type,
+ dtd) < 0)
return -1;
if (flag == CTF_ADD_ROOT && dtd->dtd_data.ctt_name
&& (name = ctf_strraw (fp, dtd->dtd_data.ctt_name)) != NULL)
{
if (ctf_dynhash_insert (ctf_name_table (fp, kind)->ctn_writable,
- (char *) name, (void *) dtd->dtd_type) < 0)
+ (char *) name, (void *) (uintptr_t)
+ dtd->dtd_type) < 0)
{
- ctf_dynhash_remove (fp->ctf_dthash, (void *) dtd->dtd_type);
+ ctf_dynhash_remove (fp->ctf_dthash, (void *) (uintptr_t)
+ dtd->dtd_type);
return -1;
}
}
int name_kind = kind;
const char *name;
- ctf_dynhash_remove (fp->ctf_dthash, (void *) dtd->dtd_type);
+ ctf_dynhash_remove (fp->ctf_dthash, (void *) (uintptr_t) dtd->dtd_type);
switch (kind)
{
ctf_dtdef_t *
ctf_dtd_lookup (const ctf_file_t *fp, ctf_id_t type)
{
- return (ctf_dtdef_t *) ctf_dynhash_lookup (fp->ctf_dthash, (void *) type);
+ return (ctf_dtdef_t *)
+ ctf_dynhash_lookup (fp->ctf_dthash, (void *) (uintptr_t) type);
}
ctf_dtdef_t *
ctf_str_remove_ref (fp, name, &dtd->dtd_data.ctt_name);
}
- ctf_dynhash_remove (fp->ctf_dthash, (void *) dtd->dtd_type);
+ ctf_dynhash_remove (fp->ctf_dthash, (void *) (uintptr_t) dtd->dtd_type);
ctf_dtd_delete (fp, dtd);
}
return (x + 1);
}
-static ctf_id_t
+ctf_id_t
ctf_add_encoded (ctf_file_t *fp, uint32_t flag,
const char *name, const ctf_encoding_t *ep, uint32_t kind)
{
return type;
}
-static ctf_id_t
+ctf_id_t
ctf_add_reftype (ctf_file_t *fp, uint32_t flag, ctf_id_t ref, uint32_t kind)
{
ctf_dtdef_t *dtd;