Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/tools/ctf/cvt/merge.c
Show First 20 Lines • Show All 520 Lines • ▼ Show 20 Lines | if (hash_find_iter(mcd->md_tdtba, ctdp, equiv_cb, &ed) < 0) { | ||||
hash_add(mcd->md_tdtba, ctdp); | hash_add(mcd->md_tdtba, ctdp); | ||||
} | } | ||||
mcd->md_parent->td_curemark = ed.ed_cur_mark + 1; | mcd->md_parent->td_curemark = ed.ed_cur_mark + 1; | ||||
return (1); | return (1); | ||||
} | } | ||||
static tdtrav_cb_f map_pre[] = { | static tdtrav_cb_f map_pre[STABTYPE_LAST] = { | ||||
NULL, | [INTRINSIC] = map_td_tree_pre, | ||||
map_td_tree_pre, /* intrinsic */ | [POINTER] = map_td_tree_pre, | ||||
map_td_tree_pre, /* pointer */ | [ARRAY] = map_td_tree_pre, | ||||
map_td_tree_pre, /* array */ | [FUNCTION] = map_td_tree_pre, | ||||
map_td_tree_pre, /* function */ | [STRUCT] = map_td_tree_pre, | ||||
map_td_tree_pre, /* struct */ | [UNION] = map_td_tree_pre, | ||||
map_td_tree_pre, /* union */ | [ENUM] = map_td_tree_pre, | ||||
map_td_tree_pre, /* enum */ | [FORWARD] = map_td_tree_pre, | ||||
map_td_tree_pre, /* forward */ | [TYPEDEF] = map_td_tree_pre, | ||||
map_td_tree_pre, /* typedef */ | [TYPEDEF_UNRES] = tdtrav_assert, | ||||
tdtrav_assert, /* typedef_unres */ | [VOLATILE] = map_td_tree_pre, | ||||
map_td_tree_pre, /* volatile */ | [CONST] = map_td_tree_pre, | ||||
map_td_tree_pre, /* const */ | [RESTRICT] = map_td_tree_pre, | ||||
map_td_tree_pre /* restrict */ | [CONSTVAL] = map_td_tree_pre, | ||||
}; | }; | ||||
static tdtrav_cb_f map_post[] = { | static tdtrav_cb_f map_post[STABTYPE_LAST] = { | ||||
NULL, | [INTRINSIC] = map_td_tree_post, | ||||
map_td_tree_post, /* intrinsic */ | [POINTER] = map_td_tree_post, | ||||
map_td_tree_post, /* pointer */ | [ARRAY] = map_td_tree_post, | ||||
map_td_tree_post, /* array */ | [FUNCTION] = map_td_tree_post, | ||||
map_td_tree_post, /* function */ | [STRUCT] = map_td_tree_post, | ||||
map_td_tree_post, /* struct */ | [UNION] = map_td_tree_post, | ||||
map_td_tree_post, /* union */ | [ENUM] = map_td_tree_post, | ||||
map_td_tree_post, /* enum */ | [FORWARD] = map_td_tree_post, | ||||
map_td_tree_post, /* forward */ | [TYPEDEF] = map_td_tree_post, | ||||
map_td_tree_post, /* typedef */ | [TYPEDEF_UNRES] = tdtrav_assert, | ||||
tdtrav_assert, /* typedef_unres */ | [VOLATILE] = map_td_tree_post, | ||||
map_td_tree_post, /* volatile */ | [CONST] = map_td_tree_post, | ||||
map_td_tree_post, /* const */ | [RESTRICT] = map_td_tree_post, | ||||
map_td_tree_post /* restrict */ | [CONSTVAL] = map_td_tree_post, | ||||
}; | }; | ||||
static tdtrav_cb_f map_self_post[] = { | static tdtrav_cb_f map_self_post[STABTYPE_LAST] = { | ||||
NULL, | [INTRINSIC] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* intrinsic */ | [POINTER] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* pointer */ | [ARRAY] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* array */ | [FUNCTION] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* function */ | [STRUCT] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* struct */ | [UNION] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* union */ | [ENUM] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* enum */ | [FORWARD] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* forward */ | [TYPEDEF] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* typedef */ | [TYPEDEF_UNRES] = tdtrav_assert, | ||||
tdtrav_assert, /* typedef_unres */ | [VOLATILE] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* volatile */ | [CONST] = map_td_tree_self_post, | ||||
map_td_tree_self_post, /* const */ | [RESTRICT] = map_td_tree_self_post, | ||||
map_td_tree_self_post /* restrict */ | [CONSTVAL] = map_td_tree_self_post, | ||||
}; | }; | ||||
markj: More places to use a designated initializer. | |||||
Done Inline ActionsSure, can do cem: Sure, can do | |||||
/* | /* | ||||
* Determining equivalence of iidesc_t nodes | * Determining equivalence of iidesc_t nodes | ||||
*/ | */ | ||||
typedef struct iifind_data { | typedef struct iifind_data { | ||||
iidesc_t *iif_template; | iidesc_t *iif_template; | ||||
alist_t *iif_ta; | alist_t *iif_ta; | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
tdesc_t *new = xcalloc(sizeof (tdesc_t)); | tdesc_t *new = xcalloc(sizeof (tdesc_t)); | ||||
new->t_name = old->t_name ? xstrdup(old->t_name) : NULL; | new->t_name = old->t_name ? xstrdup(old->t_name) : NULL; | ||||
new->t_type = old->t_type; | new->t_type = old->t_type; | ||||
new->t_size = old->t_size; | new->t_size = old->t_size; | ||||
new->t_id = newselfid; | new->t_id = newselfid; | ||||
new->t_flags = old->t_flags; | new->t_flags = old->t_flags; | ||||
new->t_extra = old->t_extra; | |||||
return (new); | return (new); | ||||
} | } | ||||
/*ARGSUSED2*/ | /*ARGSUSED2*/ | ||||
static tdesc_t * | static tdesc_t * | ||||
conjure_intrinsic(tdesc_t *old, int newselfid, merge_cb_data_t *mcd __unused) | conjure_intrinsic(tdesc_t *old, int newselfid, merge_cb_data_t *mcd __unused) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | fwd_redir(tdesc_t *fwd, tdesc_t **fwdp, void *private) | ||||
debug(3, "Redirecting an edge to %s\n", tdesc_name(defn)); | debug(3, "Redirecting an edge to %s\n", tdesc_name(defn)); | ||||
*fwdp = defn; | *fwdp = defn; | ||||
return (1); | return (1); | ||||
} | } | ||||
static tdtrav_cb_f fwd_redir_cbs[] = { | static tdtrav_cb_f fwd_redir_cbs[STABTYPE_LAST] = { | ||||
NULL, | [FORWARD] = fwd_redir, | ||||
NULL, /* intrinsic */ | [TYPEDEF_UNRES] = tdtrav_assert, | ||||
NULL, /* pointer */ | |||||
NULL, /* array */ | |||||
NULL, /* function */ | |||||
NULL, /* struct */ | |||||
NULL, /* union */ | |||||
NULL, /* enum */ | |||||
fwd_redir, /* forward */ | |||||
NULL, /* typedef */ | |||||
tdtrav_assert, /* typedef_unres */ | |||||
NULL, /* volatile */ | |||||
NULL, /* const */ | |||||
NULL /* restrict */ | |||||
}; | }; | ||||
typedef struct redir_mstr_data { | typedef struct redir_mstr_data { | ||||
tdata_t *rmd_tgt; | tdata_t *rmd_tgt; | ||||
alist_t *rmd_map; | alist_t *rmd_map; | ||||
} redir_mstr_data_t; | } redir_mstr_data_t; | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | merge_into_master(tdata_t *cur, tdata_t *mstr, tdata_t *tgt, int selfuniquify) | ||||
alist_free(mcd.md_ta); | alist_free(mcd.md_ta); | ||||
cur->td_ref--; | cur->td_ref--; | ||||
mstr->td_ref--; | mstr->td_ref--; | ||||
if (tgt) | if (tgt) | ||||
tgt->td_ref--; | tgt->td_ref--; | ||||
} | } | ||||
tdesc_ops_t tdesc_ops[] = { | tdesc_ops_t tdesc_ops[STABTYPE_LAST] = { | ||||
{ "ERROR! BAD tdesc TYPE", NULL, NULL }, | { "ERROR! BAD tdesc TYPE", NULL, NULL }, | ||||
{ "intrinsic", equiv_intrinsic, conjure_intrinsic }, | { "intrinsic", equiv_intrinsic, conjure_intrinsic }, | ||||
{ "pointer", equiv_plain, conjure_plain }, | { "pointer", equiv_plain, conjure_plain }, | ||||
{ "array", equiv_array, conjure_array }, | { "array", equiv_array, conjure_array }, | ||||
{ "function", equiv_function, conjure_function }, | { "function", equiv_function, conjure_function }, | ||||
{ "struct", equiv_su, conjure_su }, | { "struct", equiv_su, conjure_su }, | ||||
{ "union", equiv_su, conjure_su }, | { "union", equiv_su, conjure_su }, | ||||
{ "enum", equiv_enum, conjure_enum }, | { "enum", equiv_enum, conjure_enum }, | ||||
{ "forward", NULL, conjure_forward }, | { "forward", NULL, conjure_forward }, | ||||
{ "typedef", equiv_plain, conjure_plain }, | { "typedef", equiv_plain, conjure_plain }, | ||||
{ "typedef_unres", equiv_assert, conjure_assert }, | { "typedef_unres", equiv_assert, conjure_assert }, | ||||
{ "volatile", equiv_plain, conjure_plain }, | { "volatile", equiv_plain, conjure_plain }, | ||||
{ "const", equiv_plain, conjure_plain }, | { "const", equiv_plain, conjure_plain }, | ||||
{ "restrict", equiv_plain, conjure_plain } | { "restrict", equiv_plain, conjure_plain }, | ||||
{ "constval", equiv_plain, conjure_plain }, | |||||
}; | }; |
More places to use a designated initializer.