Skip to content

Commit

Permalink
c2: formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Jul 29, 2024
1 parent 4412483 commit 443c5a0
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions src/c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ struct c2_property_value {

/// Initializer for c2_ptr_t.
#define C2_PTR_INIT \
{ .isbranch = false, .l = NULL, }
{ \
.isbranch = false, \
.l = NULL, \
}

static const c2_ptr_t C2_PTR_NULL = C2_PTR_INIT;

Expand All @@ -124,7 +127,12 @@ struct _c2_b {

/// Initializer for c2_b_t.
#define C2_B_INIT \
{ .neg = false, .op = C2_B_OUNDEFINED, .opr1 = C2_PTR_INIT, .opr2 = C2_PTR_INIT, }
{ \
.neg = false, \
.op = C2_B_OUNDEFINED, \
.opr1 = C2_PTR_INIT, \
.opr2 = C2_PTR_INIT, \
}

/// Structure for leaf element in a window condition
struct _c2_l {
Expand Down Expand Up @@ -197,10 +205,18 @@ struct _c2_l {
/// Initializer for c2_l_t.
#define C2_L_INIT \
{ \
.neg = false, .op = C2_L_OEXISTS, .match = C2_L_MEXACT, \
.match_ignorecase = false, .tgt = NULL, .tgtatom = 0, \
.target_on_client = false, .predef = C2_L_PUNDEFINED, .index = 0, \
.ptntype = C2_L_PTUNDEFINED, .ptnstr = NULL, .ptnint = 0, \
.neg = false, \
.op = C2_L_OEXISTS, \
.match = C2_L_MEXACT, \
.match_ignorecase = false, \
.tgt = NULL, \
.tgtatom = 0, \
.target_on_client = false, \
.predef = C2_L_PUNDEFINED, \
.index = 0, \
.ptntype = C2_L_PTUNDEFINED, \
.ptnstr = NULL, \
.ptnint = 0, \
}

static const c2_l_t leaf_def = C2_L_INIT;
Expand All @@ -213,8 +229,11 @@ struct _c2_lptr {
};

/// Initializer for c2_lptr_t.
#define C2_LPTR_INIT \
{ .ptr = C2_PTR_INIT, .data = NULL, .next = NULL, }
static const c2_lptr_t C2_LPTR_INIT = {
.ptr = C2_PTR_INIT,
.data = NULL,
.next = NULL,
};

/// Structure representing a predefined target.
typedef struct {
Expand Down Expand Up @@ -387,9 +406,8 @@ c2_lptr_t *c2_parse(c2_lptr_t **pcondlst, const char *pattern, void *data) {

// Insert to pcondlst
{
static const c2_lptr_t lptr_def = C2_LPTR_INIT;
auto plptr = cmalloc(c2_lptr_t);
memcpy(plptr, &lptr_def, sizeof(c2_lptr_t));
*plptr = C2_LPTR_INIT;
plptr->ptr = result;
plptr->data = data;
if (pcondlst) {
Expand Down

0 comments on commit 443c5a0

Please sign in to comment.