From e4f735972769293d4555a7f5f24e2a3c1512a5eb Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 1 Nov 2023 00:01:51 +0800 Subject: [PATCH] ses_edge_t --- ses_core.h | 12 ++++++++++++ ses_utils.c | 25 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/ses_core.h b/ses_core.h index 882f9fc..3ba07f2 100644 --- a/ses_core.h +++ b/ses_core.h @@ -8,8 +8,17 @@ typedef struct ses_step_s ses_step_t; typedef struct ses_path_s ses_path_t; typedef struct ses_flow_s ses_flow_t; typedef struct ses_info_s ses_info_t; +typedef struct ses_edge_s ses_edge_t; typedef struct ses_ctx_s ses_ctx_t; +struct ses_edge_s +{ + scf_vector_t* conflicts; + + ScfEpin* p0; + ScfEpin* p1; +}; + struct ses_flow_s { scf_vector_t* paths; @@ -108,6 +117,9 @@ void ses_flow_v_pos(ses_flow_t* flow, double a, double ja); void ses_flow_v_neg(ses_flow_t* flow, double a, double ja); void ses_flow_jr (ses_flow_t* flow); +ses_edge_t* ses_edge_alloc(); +void ses_edge_free (ses_edge_t* edge); + ses_ctx_t* ses_ctx_alloc(); void ses_ctx_free (ses_ctx_t* ctx); diff --git a/ses_utils.c b/ses_utils.c index b098854..de61d5f 100644 --- a/ses_utils.c +++ b/ses_utils.c @@ -1,5 +1,30 @@ #include"ses_core.h" +ses_edge_t* ses_edge_alloc() +{ + ses_edge_t* edge = calloc(1, sizeof(ses_edge_t)); + if (!edge) + return NULL; + + edge->conflicts = scf_vector_alloc(); + if (!edge->conflicts) { + free(edge); + return NULL; + } + + return edge; +} + +void ses_edge_free(ses_edge_t* edge) +{ + if (edge) { + if (edge->conflicts) + scf_vector_free(edge->conflicts); + + free(edge); + } +} + ses_flow_t* ses_flow_alloc() { ses_flow_t* flow = calloc(1, sizeof(ses_flow_t)); -- 2.25.1