mirror of
https://github.com/bgp/bgpq4
synced 2026-09-09 01:26:14 +00:00
KNF
This commit is contained in:
@@ -122,15 +122,15 @@ parseasnumber(struct bgpq_expander* expander, char* optarg)
|
||||
sx_report(SX_FATAL,"Invalid AS number: %s\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
if(eon && *eon == '.') {
|
||||
if (eon && *eon == '.') {
|
||||
/* -f 3.3, for example */
|
||||
uint32_t loas = strtoul(eon+1, &eon, 10);
|
||||
if(expander->asnumber > 65535) {
|
||||
if (expander->asnumber > 65535) {
|
||||
/* should prevent incorrect numbers like 65537.1 */
|
||||
sx_report(SX_FATAL,"Invalid AS number: %s\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
if(loas < 1 || loas > 65535) {
|
||||
if (loas < 1 || loas > 65535) {
|
||||
sx_report(SX_FATAL,"Invalid AS number: %s\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
@@ -414,99 +414,114 @@ main(int argc, char* argv[])
|
||||
argv += optind;
|
||||
|
||||
if (!widthSet) {
|
||||
if (expander.generation==T_ASPATH) {
|
||||
if (expander.vendor == V_CISCO) {
|
||||
if (expander.generation == T_ASPATH) {
|
||||
int vendor = expander.vendor;
|
||||
switch (vendor) {
|
||||
case V_ARISTA:
|
||||
case V_CISCO:
|
||||
case V_MIKROTIK:
|
||||
expander.aswidth = 4;
|
||||
} else if (expander.vendor == V_CISCO_XR) {
|
||||
case V_CISCO_XR:
|
||||
expander.aswidth = 6;
|
||||
} else if (expander.vendor == V_JUNIPER) {
|
||||
case V_JUNIPER:
|
||||
case V_NOKIA:
|
||||
case V_NOKIA_MD:
|
||||
expander.aswidth = 8;
|
||||
} else if (expander.vendor == V_MIKROTIK) {
|
||||
expander.aswidth = 4;
|
||||
} else if (expander.vendor == V_BIRD) {
|
||||
case V_BIRD:
|
||||
expander.aswidth = 10;
|
||||
} else if (expander.vendor == V_NOKIA ||
|
||||
expander.vendor == V_NOKIA_MD) {
|
||||
expander.aswidth = 8;
|
||||
} else if (expander.vendor == V_ARISTA) {
|
||||
expander.aswidth = 4;
|
||||
}
|
||||
} else if (expander.generation == T_OASPATH) {
|
||||
if (expander.vendor == V_CISCO) {
|
||||
int vendor = expander.vendor;
|
||||
switch (vendor) {
|
||||
case V_ARISTA:
|
||||
case V_CISCO:
|
||||
expander.aswidth = 5;
|
||||
} else if (expander.vendor == V_CISCO_XR) {
|
||||
case V_CISCO_XR:
|
||||
expander.aswidth = 7;
|
||||
} else if (expander.vendor==V_JUNIPER) {
|
||||
case V_JUNIPER:
|
||||
case V_NOKIA:
|
||||
case V_NOKIA_MD:
|
||||
expander.aswidth = 8;
|
||||
} else if (expander.vendor == V_NOKIA ||
|
||||
expander.vendor == V_NOKIA_MD) {
|
||||
expander.aswidth = 8;
|
||||
} else if (expander.vendor == V_ARISTA) {
|
||||
expander.aswidth = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!expander.generation) {
|
||||
if (!expander.generation)
|
||||
expander.generation = T_PREFIXLIST;
|
||||
}
|
||||
|
||||
if (expander.vendor == V_CISCO_XR && expander.generation != T_PREFIXLIST &&
|
||||
expander.generation != T_ASPATH && expander.generation != T_OASPATH) {
|
||||
if (expander.vendor == V_CISCO_XR
|
||||
&& expander.generation != T_PREFIXLIST
|
||||
&& expander.generation != T_ASPATH
|
||||
&& expander.generation != T_OASPATH) {
|
||||
sx_report(SX_FATAL, "Sorry, only prefix-sets and as-paths "
|
||||
"supported for IOS XR\n");
|
||||
}
|
||||
if (expander.vendor == V_BIRD && expander.generation != T_PREFIXLIST &&
|
||||
expander.generation != T_ASPATH && expander.generation != T_ASSET) {
|
||||
if (expander.vendor == V_BIRD
|
||||
&& expander.generation != T_PREFIXLIST
|
||||
&& expander.generation != T_ASPATH
|
||||
&& expander.generation != T_ASSET) {
|
||||
sx_report(SX_FATAL, "Sorry, only prefix-lists and as-paths/as-sets "
|
||||
"supported for BIRD output\n");
|
||||
}
|
||||
if (expander.vendor == V_JSON && expander.generation != T_PREFIXLIST &&
|
||||
expander.generation != T_ASPATH && expander.generation != T_ASSET) {
|
||||
if (expander.vendor == V_JSON
|
||||
&& expander.generation != T_PREFIXLIST
|
||||
&& expander.generation != T_ASPATH
|
||||
&& expander.generation != T_ASSET) {
|
||||
sx_report(SX_FATAL, "Sorry, only prefix-lists and as-paths/as-sets "
|
||||
"supported for JSON output\n");
|
||||
}
|
||||
|
||||
if (expander.vendor == V_FORMAT && expander.generation != T_PREFIXLIST)
|
||||
if (expander.vendor == V_FORMAT
|
||||
&& expander.generation != T_PREFIXLIST)
|
||||
sx_report(SX_FATAL, "Sorry, only prefix-lists supported in formatted "
|
||||
"output\n");
|
||||
|
||||
if (expander.vendor == V_HUAWEI && expander.generation != T_ASPATH &&
|
||||
expander.generation != T_OASPATH && expander.generation != T_PREFIXLIST)
|
||||
if (expander.vendor == V_HUAWEI
|
||||
&& expander.generation != T_ASPATH
|
||||
&& expander.generation != T_OASPATH
|
||||
&& expander.generation != T_PREFIXLIST)
|
||||
sx_report(SX_FATAL, "Sorry, only as-paths and prefix-lists supported "
|
||||
"for Huawei output\n");
|
||||
|
||||
if (expander.generation == T_ROUTE_FILTER_LIST && expander.vendor != V_JUNIPER)
|
||||
if (expander.generation == T_ROUTE_FILTER_LIST
|
||||
&& expander.vendor != V_JUNIPER)
|
||||
sx_report(SX_FATAL, "Route-filter-lists (-z) supported for Juniper (-J)"
|
||||
" output only\n");
|
||||
|
||||
if (expander.generation == T_ASSET && expander.vendor != V_JSON &&
|
||||
expander.vendor != V_OPENBGPD && expander.vendor != V_BIRD)
|
||||
if (expander.generation == T_ASSET
|
||||
&& expander.vendor != V_JSON
|
||||
&& expander.vendor != V_OPENBGPD
|
||||
&& expander.vendor != V_BIRD)
|
||||
sx_report(SX_FATAL, "As-Sets (-t) supported for JSON (-j), OpenBGPD "
|
||||
"(-B) and BIRD (-b) output only\n");
|
||||
|
||||
if (aggregate && expander.vendor == V_JUNIPER && expander.generation == T_PREFIXLIST) {
|
||||
if (aggregate
|
||||
&& expander.vendor == V_JUNIPER
|
||||
&& expander.generation == T_PREFIXLIST) {
|
||||
sx_report(SX_FATAL, "Sorry, aggregation (-A) does not work in"
|
||||
" Juniper prefix-lists\nYou can try route-filters (-E) "
|
||||
"or route-filter-lists (-z) instead of prefix-lists\n.");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (aggregate && (expander.vendor == V_NOKIA_MD || expander.vendor == V_NOKIA)
|
||||
if (aggregate
|
||||
&& (expander.vendor == V_NOKIA_MD || expander.vendor == V_NOKIA)
|
||||
&& expander.generation != T_PREFIXLIST) {
|
||||
sx_report(SX_FATAL, "Sorry, aggregation (-A) is not supported with "
|
||||
"ip-prefix-lists (-E) on Nokia.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (refine && (expander.vendor == V_NOKIA_MD || expander.vendor == V_NOKIA)
|
||||
if (refine
|
||||
&& (expander.vendor == V_NOKIA_MD || expander.vendor == V_NOKIA)
|
||||
&& expander.generation != T_PREFIXLIST) {
|
||||
sx_report(SX_FATAL, "Sorry, more-specifics (-R) is not supported with "
|
||||
"ip-prefix-lists (-E) on Nokia.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (refineLow && (expander.vendor == V_NOKIA_MD || expander.vendor == V_NOKIA)
|
||||
if (refineLow
|
||||
&& (expander.vendor == V_NOKIA_MD || expander.vendor == V_NOKIA)
|
||||
&& expander.generation != T_PREFIXLIST) {
|
||||
sx_report(SX_FATAL, "Sorry, more-specifics (-r) is not supported with "
|
||||
"ip-prefix-lists (-E) on Nokia.\n");
|
||||
@@ -519,7 +534,8 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (expander.sequence && (expander.vendor != V_CISCO && expander.vendor != V_ARISTA)) {
|
||||
if (expander.sequence
|
||||
&& (expander.vendor != V_CISCO && expander.vendor != V_ARISTA)) {
|
||||
sx_report(SX_FATAL, "Sorry, prefix-lists sequencing (-s) supported"
|
||||
" only for IOS and EOS\n");
|
||||
exit(1);
|
||||
@@ -538,10 +554,9 @@ main(int argc, char* argv[])
|
||||
refine = 128;
|
||||
}
|
||||
|
||||
if (refineLow && refineLow > refine) {
|
||||
if (refineLow && refineLow > refine)
|
||||
sx_report(SX_FATAL, "Incompatible values for -r %u and -R %u\n",
|
||||
refineLow, refine);
|
||||
}
|
||||
|
||||
if (refine || refineLow) {
|
||||
if (expander.family == AF_INET6 && refine > 128) {
|
||||
@@ -573,13 +588,12 @@ main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
if (expander.generation < T_PREFIXLIST) {
|
||||
if (refine) {
|
||||
if (refine)
|
||||
sx_report(SX_FATAL, "Sorry, more-specific filter (-R %u) "
|
||||
"supported only with prefix-list generation\n", refine);
|
||||
} else {
|
||||
else
|
||||
sx_report(SX_FATAL, "Sorry, more-specific filter (-r %u) "
|
||||
"supported only with prefix-list generation\n", refineLow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,11 +611,10 @@ main(int argc, char* argv[])
|
||||
*/
|
||||
expander.maxlen = maxlen;
|
||||
}
|
||||
} else if (expander.family == AF_INET) {
|
||||
} else if (expander.family == AF_INET)
|
||||
expander.maxlen = 32;
|
||||
} else if (expander.family == AF_INET6) {
|
||||
else if (expander.family == AF_INET6)
|
||||
expander.maxlen = 128;
|
||||
}
|
||||
|
||||
if (expander.generation == T_EACL && expander.vendor == V_CISCO
|
||||
&& expander.family == AF_INET6) {
|
||||
|
||||
+25
-26
@@ -24,7 +24,6 @@ int bgpq4_print_openbgpd_asset(FILE* f, struct bgpq_expander* b);
|
||||
int
|
||||
bgpq4_print_cisco_aspath(FILE* f, struct bgpq_expander* b)
|
||||
{
|
||||
|
||||
int nc = 0, i, j, k, empty = 1;
|
||||
|
||||
fprintf(f, "no ip as-path access-list %s\n", b->name ? b->name : "NN");
|
||||
@@ -113,7 +112,7 @@ bgpq4_print_cisco_xr_aspath(FILE* f, struct bgpq_expander* b)
|
||||
comma ? "," : "",
|
||||
b->asnumber,
|
||||
k * 65536 + i * 8 + j);
|
||||
comma=1;
|
||||
comma = 1;
|
||||
} else {
|
||||
fprintf(f, "|%u",
|
||||
k * 65536 + i * 8 + j);
|
||||
@@ -173,12 +172,12 @@ bgpq4_print_cisco_oaspath(FILE* f, struct bgpq_expander* b)
|
||||
empty = 0;
|
||||
} else {
|
||||
fprintf(f,"|%u",k*65536+i*8+j);
|
||||
empty=0;
|
||||
empty = 0;
|
||||
}
|
||||
|
||||
nc++;
|
||||
|
||||
if (nc==b->aswidth) {
|
||||
if (nc == b->aswidth) {
|
||||
fprintf(f,")$\n");
|
||||
nc = 0;
|
||||
}
|
||||
@@ -236,7 +235,7 @@ bgpq4_print_cisco_xr_oaspath(FILE* f, struct bgpq_expander* b)
|
||||
nc++;
|
||||
if (nc == b->aswidth) {
|
||||
fprintf(f,")$'");
|
||||
nc=0;
|
||||
nc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,7 +373,7 @@ bgpq4_print_openbgpd_oaspath(FILE* f, struct bgpq_expander* b)
|
||||
{
|
||||
int i, j, k, lineNo = 0;
|
||||
|
||||
for (k=0; k<65536; k++) {
|
||||
for (k = 0; k < 65536; k++) {
|
||||
|
||||
if (!b->asn32s[k])
|
||||
continue;
|
||||
@@ -400,7 +399,7 @@ bgpq4_print_openbgpd_oaspath(FILE* f, struct bgpq_expander* b)
|
||||
int
|
||||
bgpq4_print_nokia_aspath(FILE* f, struct bgpq_expander* b)
|
||||
{
|
||||
int nc = 0, lineNo=1, i, j, k;
|
||||
int nc = 0, lineNo = 1, i, j, k;
|
||||
|
||||
fprintf(f, "configure router policy-options\n"
|
||||
"begin\nno as-path-group \"%s\"\n",
|
||||
@@ -530,15 +529,15 @@ bgpq4_print_huawei_aspath(FILE* f, struct bgpq_expander* b)
|
||||
(0x80 >> (b->asnumber % 8))) {
|
||||
fprintf(f, "ip as-path-filter %s permit ^%u(_%u)*$\n",
|
||||
b->name ? b->name : "NN", b->asnumber, b->asnumber);
|
||||
empty=0;
|
||||
empty = 0;
|
||||
}
|
||||
|
||||
for (k=0; k<65536; k++) {
|
||||
for (k = 0; k < 65536; k++) {
|
||||
|
||||
if (!b->asn32s[k])
|
||||
continue;
|
||||
|
||||
for (i=0; i < 8192; i++) {
|
||||
for (i = 0; i < 8192; i++) {
|
||||
for (j = 0; j < 8 ; j++) {
|
||||
|
||||
if (b->asn32s[k][i] & (0x80 >> j)) {
|
||||
@@ -841,7 +840,7 @@ bgpq4_print_jprefix(struct sx_radix_node* n, void* ff)
|
||||
fprintf(f," %s;\n", prefix);
|
||||
}
|
||||
|
||||
static int needscomma=0;
|
||||
static int needscomma = 0;
|
||||
|
||||
void
|
||||
bgpq4_print_json_prefix(struct sx_radix_node* n, void* ff)
|
||||
@@ -931,7 +930,7 @@ bgpq4_print_bird_prefix(struct sx_radix_node* n, void* ff)
|
||||
goto checkSon;
|
||||
|
||||
if (!f)
|
||||
f=stdout;
|
||||
f = stdout;
|
||||
|
||||
sx_prefix_snprintf(n->prefix, prefix, sizeof(prefix));
|
||||
|
||||
@@ -955,7 +954,7 @@ checkSon:
|
||||
int
|
||||
bgpq4_print_bird_aspath(FILE* f, struct bgpq_expander* b)
|
||||
{
|
||||
int nc=0, i, j, k, empty=1;
|
||||
int nc = 0, i, j, k, empty = 1;
|
||||
char buffer[2048];
|
||||
snprintf(buffer, sizeof(buffer), "%s = [", b->name ? b->name : "NN");
|
||||
|
||||
@@ -1160,7 +1159,7 @@ bgpq4_print_cprefix(struct sx_radix_node* n, void* ff)
|
||||
}
|
||||
} else {
|
||||
fprintf(f,"%s prefix-list %s%s permit %s\n",
|
||||
n->prefix->family==AF_INET ? "ip" : "ipv6",
|
||||
(n->prefix->family == AF_INET) ? "ip" : "ipv6",
|
||||
bname ? bname : "NN", seqno, prefix);
|
||||
}
|
||||
|
||||
@@ -1321,13 +1320,13 @@ bgpq4_print_ceacl(struct sx_radix_node* n, void* ff)
|
||||
wildaddr = wildaddr &(~wild2addr);
|
||||
|
||||
if (masklen == 32)
|
||||
mask=0xfffffffful;
|
||||
mask = 0xfffffffful;
|
||||
|
||||
else
|
||||
mask = 0xfffffffful & (0xfffffffful << (32 - masklen));
|
||||
|
||||
if (n->aggregateHi == 32)
|
||||
wild2addr=0;
|
||||
wild2addr = 0;
|
||||
else
|
||||
wild2addr = 0xfffffffful >> n->aggregateHi;
|
||||
|
||||
@@ -1450,7 +1449,7 @@ bgpq4_print_nokia_md_prefix(struct sx_radix_node* n, void* ff)
|
||||
goto checkSon;
|
||||
|
||||
if (!f)
|
||||
f=stdout;
|
||||
f = stdout;
|
||||
|
||||
sx_prefix_snprintf(n->prefix, prefix, sizeof(prefix));
|
||||
|
||||
@@ -1590,10 +1589,10 @@ bgpq4_print_cisco_prefixlist(FILE* f, struct bgpq_expander* b)
|
||||
} else {
|
||||
fprintf(f, "! generated prefix-list %s is empty\n", bname);
|
||||
fprintf(f, "%s prefix-list %s%s deny %s\n",
|
||||
b->family==AF_INET ? "ip" : "ipv6",
|
||||
(b->family == AF_INET) ? "ip" : "ipv6",
|
||||
bname,
|
||||
seq ? " seq 1" : "",
|
||||
b->family==AF_INET ? "0.0.0.0/0" : "::/0");
|
||||
(b->family == AF_INET) ? "0.0.0.0/0" : "::/0");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1648,16 +1647,16 @@ bgpq4_print_huawei_prefixlist(FILE* f, struct bgpq_expander* b)
|
||||
seq = b->sequence;
|
||||
|
||||
fprintf(f,"undo ip %s-prefix %s\n",
|
||||
b->family==AF_INET ? "ip" : "ipv6", bname);
|
||||
(b->family == AF_INET) ? "ip" : "ipv6", bname);
|
||||
|
||||
if (!sx_radix_tree_empty(b->tree)) {
|
||||
sx_radix_tree_foreach(b->tree, bgpq4_print_hprefix, f);
|
||||
} else {
|
||||
fprintf(f, "ip %s-prefix %s%s deny %s\n",
|
||||
b->family==AF_INET ? "ip" : "ipv6",
|
||||
(b->family == AF_INET) ? "ip" : "ipv6",
|
||||
bname,
|
||||
seq ? " seq 1" : "",
|
||||
b->family==AF_INET ? "0.0.0.0/0" : "::/0");
|
||||
(b->family == AF_INET) ? "0.0.0.0/0" : "::/0");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1682,10 +1681,10 @@ bgpq4_print_arista_prefixlist(FILE* f, struct bgpq_expander* b)
|
||||
} else {
|
||||
fprintf(f, "! generated prefix-list %s is empty\n", bname);
|
||||
fprintf(f, "%s prefix-list %s\n seq %i deny %s\n",
|
||||
b->family==AF_INET ? "ip" : "ipv6",
|
||||
(b->family == AF_INET) ? "ip" : "ipv6",
|
||||
bname,
|
||||
seq,
|
||||
b->family==AF_INET ? "0.0.0.0/0" : "::/0");
|
||||
(b->family == AF_INET) ? "0.0.0.0/0" : "::/0");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1754,7 +1753,7 @@ bgpq4_print_format_prefixlist(FILE* f, struct bgpq_expander* b)
|
||||
int
|
||||
bgpq4_print_nokia_prefixlist(FILE* f, struct bgpq_expander* b)
|
||||
{
|
||||
bname=b->name ? b->name : "NN";
|
||||
bname = b->name ? b->name : "NN";
|
||||
fprintf(f,"configure router policy-options\nbegin\nno prefix-list \"%s\"\n",
|
||||
bname);
|
||||
fprintf(f,"prefix-list \"%s\"\n", bname);
|
||||
@@ -1787,7 +1786,7 @@ bgpq4_print_nokia_ipprefixlist(FILE* f, struct bgpq_expander* b)
|
||||
bname = b->name ? b->name : "NN";
|
||||
|
||||
fprintf(f, "configure filter match-list\nno %s-prefix-list \"%s\"\n",
|
||||
b->tree->family==AF_INET ? "ip" : "ipv6", bname);
|
||||
(b->tree->family == AF_INET) ? "ip" : "ipv6", bname);
|
||||
|
||||
fprintf(f, "%s-prefix-list \"%s\" create\n",
|
||||
b->tree->family == AF_INET ? "ip":"ipv6", bname);
|
||||
|
||||
+12
-10
@@ -169,7 +169,7 @@ sx_prefix_parse(struct sx_prefix* p, int af, char* text)
|
||||
if (masklen == -1)
|
||||
p->masklen = 32;
|
||||
else {
|
||||
if(masklen < 0 || masklen > 32) {
|
||||
if (masklen < 0 || masklen > 32) {
|
||||
p->masklen = 32;
|
||||
} else {
|
||||
p->masklen = masklen;
|
||||
@@ -410,7 +410,7 @@ sx_prefix_snprintf_fmt(struct sx_prefix* p, FILE* f,
|
||||
char prefix[128];
|
||||
|
||||
while (*c) {
|
||||
if(*c == '%') {
|
||||
if (*c == '%') {
|
||||
switch (*(c + 1)) {
|
||||
case 'r':
|
||||
case 'n':
|
||||
@@ -603,14 +603,14 @@ next:
|
||||
if (node->parent->r == node) {
|
||||
node->parent->r = node->l;
|
||||
node->l->parent = node->parent;
|
||||
} else if(node->parent->l==node) {
|
||||
} else if (node->parent->l==node) {
|
||||
node->parent->l=node->l;
|
||||
node->l->parent=node->parent;
|
||||
} else {
|
||||
sx_report(SX_ERROR,"Unlinking node which is not descendant "
|
||||
"of its parent\n");
|
||||
}
|
||||
} else if(tree->head==node) {
|
||||
} else if (tree->head==node) {
|
||||
tree->head=node->l;
|
||||
node->l->parent=NULL;
|
||||
} else {
|
||||
@@ -621,7 +621,7 @@ next:
|
||||
} else {
|
||||
/* the only case - node does not have descendants */
|
||||
if (node->parent) {
|
||||
if(node->parent->l == node)
|
||||
if (node->parent->l == node)
|
||||
node->parent->l = NULL;
|
||||
else if (node->parent->r == node)
|
||||
node->parent->r=NULL;
|
||||
@@ -840,9 +840,11 @@ sx_radix_node_foreach(struct sx_radix_node* node,
|
||||
|
||||
int
|
||||
sx_radix_tree_foreach(struct sx_radix_tree* tree,
|
||||
void (*func)(struct sx_radix_node*, void*), void* udata)
|
||||
void (*func)(struct sx_radix_node*, void*), void* udata)
|
||||
{
|
||||
if(!func || !tree || !tree->head) return 0;
|
||||
if (!func || !tree || !tree->head)
|
||||
return 0;
|
||||
|
||||
sx_radix_node_foreach(tree->head,func,udata);
|
||||
return 0;
|
||||
}
|
||||
@@ -850,12 +852,12 @@ sx_radix_tree_foreach(struct sx_radix_tree* tree,
|
||||
int
|
||||
sx_radix_node_aggregate(struct sx_radix_node* node)
|
||||
{
|
||||
if(node->l)
|
||||
if (node->l)
|
||||
sx_radix_node_aggregate(node->l);
|
||||
if(node->r)
|
||||
if (node->r)
|
||||
sx_radix_node_aggregate(node->r);
|
||||
|
||||
if(debug_aggregation) {
|
||||
if (debug_aggregation) {
|
||||
printf("Aggregating on node: ");
|
||||
sx_prefix_fprint(stdout,node->prefix);
|
||||
printf(" %s%s%u,%u\n", node->isGlue?"Glue ":"",
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ name##_SPLAY_INSERT(struct name *head, struct type *elm) \
|
||||
int __comp; \
|
||||
name##_SPLAY(head, elm); \
|
||||
__comp = (cmp)(elm, (head)->sph_root); \
|
||||
if(__comp < 0) { \
|
||||
if (__comp < 0) { \
|
||||
SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
|
||||
SPLAY_RIGHT(elm, field) = (head)->sph_root; \
|
||||
SPLAY_LEFT((head)->sph_root, field) = NULL; \
|
||||
|
||||
Reference in New Issue
Block a user